- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int a, temp, weeks, days, hours, minutes;
- cout<<"請輸入您要換算的數字:";
- cin>>a;
-
- weeks=a/604800;
- cout<<weeks<<" Weeks,";
-
- temp=a-(weeks*7*24*60*60);
- days=temp/86400;
- cout<<days<<" Days,";
-
- temp=temp-(days*24*60*60);
- hours=temp/3600;
- cout<<hours<<" Hours,";
-
- temp=temp-(hours*60*60);
- minutes=temp/60;
- cout<<minutes<<" Minutes,";
-
- temp=temp-(minutes*60);
- cout<<temp<<" Seconds"<<endl<<endl;;
- system("pause");
- return 0;
- }
複製代碼 |