- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int m;
- cout<<"請輸入您想轉換的秒數: ";
- cin>>m;
- cout<<m<<"秒可轉換為..."<<endl;
- cout<<m/(7*24*60*60)<<"週, ";
- m=m%(7*24*60*60);
- cout<<m/(24*60*60)<<"天, ";
- m=m%(24*60*60);
- cout<<m/(60*60)<<"小時, ";
- m=m%(60*60);
- cout<<m/60<<"分鐘,";
- m=m%60;
- cout<<m<<"秒。"<<endl;
- system("pause");
- return 0;
- }
複製代碼 |