返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int s;
  7.     cout<<"請輸入您想轉換的秒數: ";
  8.     cin>>s;
  9.     cout<<s<<"秒可轉換為..."<<endl;
  10.     cout<<s/(60*60*24*7)<<"周, ";
  11.     s=s%(60*60*24*7);
  12.     cout<<s/(60*60*24)<<"天, ";
  13.     s=s%(60*60*24);
  14.     cout<<s/(60*60)<<"小時, ";
  15.     s=s%(60*60);
  16.     cout<<s/60<<"分鐘, ";
  17.     s=s%60;
  18.     cout<<s<<"秒"<<endl;
  19.     system("pause");
  20.     return 0;
  21. }
複製代碼

TOP

返回列表