打印月历)输入月份 m(1≤m≤12),按一定格式打印 2015 第m 月的月历。
例如,2015 年一月的月历打印效果如下(第一列为周日):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include<iostream> using namespace std; const int dayNum[]={-1,31,28,31,30,31,30,31,31,30,31,30,31}; int m, offset, i; int main() { cin >> m; cout <<"S\tM\tT\tW\tT\tF\tS"<<endl;//'\t'为tab制表符 ①; for (i = 1; i < m; i++) offset = ②; for (i = 0; i < offset; i++) cout <<'\t'; for (i = 1; i <= ③;i++) { cout << ④; if(i==dayNum[m]||⑤==0) cout << endl; else cout << '\t'; } return 0; } |
0 of 5 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 5 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
1. 填空位置 ①
填空:
2. 填空位置 ②
3. 填空位置 ③
}
4. 填空位置 ④
5. 填空位置 ⑤