返回列表 發帖

【隨堂測驗】 時間換算_請等一下 進階

附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊
May

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

TOP

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

TOP

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

TOP

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

TOP

本帖最後由 張淯祺 於 2020-1-18 11:15 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int t=0;
  7.     cout<<"請輸入秒數"<<endl;
  8.     cin>>ㄔ;
  9.     cin<<t/3600<<"時,";
  10.     t%=3600;
  11.     cin<<t/60<<"分,";
  12.     t%=60;
  13.     cout<<t<<"秒"<<endl;
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

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

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. int t;
  7. cout<<"請輸入想換算的秒數:"endl;
  8. cin>>t;
  9. cout<<t<<
  10. "秒換算為:"<<endl;
  11. cout<<t/(60*60)<<"";
  12. t%=60*60;
  13. cout<<t/60<<"分";
  14. t%60;
  15. cout<<t<<"秒"<<endl;
  16. system("pause");
  17.     return 0;   
  18. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.    int t;
  7.    cout<<"請輸入想換算的秒數:";
  8.    cin>>t;
  9.    cout<<t/(60*60)<<"時";
  10.    t%=60*60;
  11.     cout<<t<<"秒換算為"<<endl;
  12.    cout<<t/60<<"分"<<endl;
  13.    t=t%60;
  14.    cout<<t<<"秒"<<endl;
  15.   system("pause");
  16.      return 0;
  17.             
  18. }
複製代碼

TOP

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

TOP

返回列表