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