- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- re:
- system("cls");
- int a,b;
- cout<<"請輸入該月的天數(28~31):";
- cin>>a;
- cout<<"請輸入該月的一號落在第一周的第幾天:";
- cin>>b;
- cout<<endl;
- cout<<"日\t一\t二\t三\t四\t五\t六"<<endl;
- for(int j=1;j<=a+b-1;j++)
- {
- if(j<b)
- {
- cout<<" \t";
- }else
- {
- cout<<j-(b-1)<<" \t";
- }
- if(j%7==0)
- {
- cout<<endl;
- }
- }
- cout<<endl;
- cout<<endl;
- system("pause");
- goto re;
- system("pause");
- return 0;
- }
複製代碼 |