返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int min;
  7.     cout<<"????作弊專用時間換算機????"<<endl;
  8.     cout<<"請輸入分鐘數: "<<endl;
  9.     cin>>min;
  10.     cout<<min<<"分鐘可換成......"<<endl;
  11.     if(min>=525600)
  12.     {
  13.     cout<<min/525600<<"年";
  14.     min=min%525600;
  15.                     }
  16.     if(min>=1440)
  17.     {
  18.     cout<<min/1440<<"天";
  19.     min=min%1440;
  20.                     }
  21.     if(min>=60)
  22.     {
  23.     cout<<min/60<<"時";            
  24.     min=min%60;
  25.                     }
  26.     if(min>=1)
  27.         {
  28.     cout<<min<<"分";
  29.     min=min%3600;
  30.                     }
  31.     system ("pause");
  32.     return 0;
  33. }   
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int s;
  7.     cout<<"????作弊專用時間換算機????"<<endl;
  8.     cout<<"請輸入秒數: "<<endl;
  9.     cin>>s;
  10.     cout<<s<<"秒可換成......"<<endl;
  11.     if(s>=31536000)
  12.     {
  13.     cout<<s/31536000<<"年";
  14.     s=s%31536000;
  15.                     }
  16.     if(s>=86400)
  17.     {
  18.     cout<<s/86400<<"天";
  19.     s=s%86400;
  20.                     }
  21.     if(s>=3600)
  22.     {
  23.     cout<<s/3600<<"時";            
  24.     s=s%3600;
  25.                     }
  26.     if(s>=60)
  27.         {
  28.     cout<<s/60<<"分";
  29.     s=s%60;
  30.                     }
  31.         if(s>=1)
  32.         {
  33.     cout<<s<<"秒";
  34.     s=s%1;
  35.                     }
  36.     system ("pause");
  37.     return 0;
  38. }   
複製代碼

TOP

返回列表