返回列表 發帖

時間換算機

本帖最後由 tonyh 於 2011-12-10 17:09 編輯

將輸入的分鐘數, 換算成幾天幾小時幾分鐘.
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int sum, a[3];    //a[0] a[1] a[2]
  6.     cout<<"請輸入您想換算的分鐘數: ";
  7.     cin>>sum;
  8.     cout<<sum<<"分鐘可換算為..."<<endl;
  9.     a[0]=sum/1440;
  10.     sum=sum%1440;
  11.     a[1]=sum/60;
  12.     a[2]=sum%60;
  13.     cout<<a[0]<<"天, "<<a[1]<<"小時, "<<a[2]<<"分鐘."<<endl;
  14.     system("pause");
  15.     return 0;   
  16. }
複製代碼

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int sum,a[3];
  6.     cout<<" 請輸入想換算的分鐘數"<<endl;
  7.     cin>>sum;
  8.     cout<<"分鐘可換算為..."<<endl;
  9.     a[0]=sum/1440;
  10.     sum=sum%1440;
  11.     a[1]=sum/60;
  12.     a[2]=sum%60;
  13.     cout<<a[0]<<"天."<<a[1]<<"小時."<<a[2]<<"分鐘."<<endl;
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    int sum,a[1];
  6.    cout<<"請輸入你想換算的分鐘數:  ";
  7.    cin>>sum;
  8.    cout<<sum<<"分鐘可換算為..."<<endl;
  9.    a[0]=sum/1440;
  10.    sum=sum%1440;
  11.    a[1]=sum/60;  
  12.    a[2]=sum%60;
  13.    cout<<a[0]<<"天,"<<a[1]<<"小時,"<<a[2]<<"分鐘."<<endl;
  14.    system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int sum,a[3];
  6.     cout<<"請輸入您想換算的分鐘數: ";
  7.     cin>>sum;
  8.     cout<<sum<<"分鐘可換算為..." <<endl;
  9.     a[0]=sum/1440;
  10.     a[1]=sum/60;
  11.     a[2]=sum%60;
  12.     cout<<a[0]<<"天, "<<a[1]<<"小時, "<<a[2]<<"分鐘"<<endl;
  13. system("pause");
  14. return 0;   
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int sum,a[3];
  6. cout<<"請輸入你想換算的時間:";
  7. cin>>sum;
  8. cout<<sum<<"分鐘可換算為..."<<endl;
  9. a[0]=sum/1440;
  10. sum=sum%1440;
  11. a[1]=sum/60;
  12. a[2]=sum/60;
  13. cout<<a[0]<<"天,"<<a[1]<<"小時,"<<a[2]<<"分鐘."<<endl;
  14. system("pause");
  15. return 0;
  16. }
複製代碼

TOP

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.   int sum, a[3];
  6.   cout<<"請輸入您想換算的分鐘數:";
  7.   cin>>sum;
  8.   cout<<sum<<"分鐘可換質為..."<<endl;
  9.   a[0]=sum/1440;
  10.   sum=sum%1440;
  11.   a[1]=sum/60;
  12.   a[2]=sum%60;
  13.   cout<<a[0]<<"天, "<<a[1]<<"小時, "<<a[2]
  14.   <<"分鐘."<<endl;  
  15. system("pause");   
  16. return 0;
  17. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int sum, a[3];    //a[0] a[1] a[2]
  6.   cout<<"請輸入您想換算的分鐘數: ";
  7.   cin>>sum;
  8.   cout<<sum<<"分鐘可換算為..."<<endl;
  9.   a[0]=sum/1440;
  10.   sum=sum%1440;
  11.   a[1]=sum/60;
  12.   a[2]=sum%60;
  13. cout<<a[0]<<"天, "<<a[1]<<"小時, "<<a[2]<<"分鐘."<<endl;
  14. system("pause");
  15. return 0;   
  16. }
複製代碼

TOP

返回列表