Advertisement
Allasview

Chap4 (task6) correct variant (secondsConv)

Dec 18th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(int argc, const int * argv[])
  5.  
  6. {
  7.     int allSec, days, hours, min, sec;
  8.     const int secInDay = 86400;
  9.     cout << " Convert seconds into format days.hours.min.sec. \n ";
  10.     cout << " Enter the quantity of seconds you'd like to be coverted  \n ";
  11.     cin >> allSec;
  12.     days = allSec / 60 / 60 / 24;
  13.     hours = allSec % secInDay / 3600;
  14.     min = allSec % secInDay % 3600 / 60;
  15.     sec = allSec % secInDay % 3600 % 60;
  16.     cout << " Your seconds are:" << days << " Day(s), " << hours << " Hour(s), " << min << " min, " << sec << " Seconds. " << std::endl;
  17.    
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement