返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.   re:
  7.   system("cls");
  8.   int days,start;
  9.   cout <<"輸入該月有幾天(28-31)";
  10.   cin>>days;
  11.   cout<<endl<<"請輸入該月的一號落在第一週的第幾天(1~7): ";
  12.   cin>>start;
  13.   cout<<endl<<"日\t一\t二\t三\t四\t五\t六"<<endl;
  14.    for(int i=1; i<=days+(start-1); i++)
  15.   {
  16.       if(i<start)
  17.       {
  18.          cout<<" \t";
  19.       }
  20.       else
  21.       {
  22.           cout<<i-(start-1)<<"\t";
  23.       }
  24.       if(i%7==0)
  25.       cout<<endl;
  26.   }
  27.   cout<<endl<<endl;
  28.   system("pause");
  29.   goto re;
  30.   return 0;
  31. }
複製代碼

TOP

返回列表