返回列表 發帖
  1. /**1.將輸入之秒數轉換成「時:分:秒」。如輸入 10000,則輸出 02:46:40。**/
  2. #include<iostream>
  3. using namespace std;

  4. int main()
  5. {
  6.     int a;
  7.     cout<<"請輸入一個秒數"<<endl;
  8.       while(cin>>a)
  9.       {
  10.         int minute;
  11.         int hour;
  12.         hour=a/3600;
  13.          a=a-(hour*3600);
  14.          minute=a/60;
  15.          a=a-(minute*60);
  16.         
  17.         
  18.       
  19.         cout <<  hour << " : " <<minute << " : " << a << endl ;   
  20.                
  21.       }
  22.   system("pause");
  23.   return 0;  
  24. }
複製代碼

TOP

返回列表