- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int m;
- cout<<"請輸入你想換算的秒數:";
- cin>>m;
- cout<<m<<"秒可換算為..."<<endl;
- cout<<m/(24*60*60*7)<<"週,";
- m=m%(24*60*60*7);
- 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;
- }
複製代碼 |