← 查看本卷题目
组合题5 个小题
已作答 0 / 5

完善程序: (打印日历) 输入月份 m(1≤m≤12)m(1\leq m\leq 12),按一定格式打印 20152015 年第 mm 月的月历。(第三、四空 2.52.5 分, 其余 33 分) 例如,20152015 年 11 月的月历打印效果如下(第一列为周日):

S	M	T	W	T	F	S				1	2	34	5	6	7	8	9	1011	12	13	14	15	16	1718	19	20	21	22	23	2425	26	27	28	29	30	31

#include <iostream>#include <string>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);}
第 30 题填空题

④处应填( )

填写答案