Advertisement
fueanta

Time Conversion

Sep 6th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(void) {
  5.     cout << "Time is seconds: ";
  6.     int t_in_sec;
  7.     cin >> t_in_sec;
  8.     int H=t_in_sec/3600;
  9.     int M=(t_in_sec%3600)/60;
  10.     int S=(t_in_sec%3600)%60;;
  11.     cout << "\nTime in hh:mm:ss = ";
  12.     cout << H << ":" << M << ":" << S << endl;
  13.     cout << endl;
  14.     decision:
  15.     cout << "Run Again(Yes/No)?" << endl;
  16.     string y_n; cout << "->"; cin.sync(); getline(cin,y_n);
  17.     if (y_n=="Yes" || y_n =="yes") {
  18.         cout << endl;
  19.         main();
  20.     }
  21.     else if (y_n=="No" || y_n=="no")
  22.         cout << "\nThank You." << endl;
  23.     else {
  24.         cout << "\nF**k You! Yes/No only.\n" << endl;
  25.         goto decision;
  26.     }
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement