fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main( )
  5. {
  6. int x, h, m, s, hourInSec, minAndSec, minInSec;
  7. cout << "This program converts seconds into hours, minutes and seconds." << endln;
  8. cout << "Enter the number of seconds: ";
  9. cin >> x;
  10.  
  11. x % 3600 = minAndSec;
  12. x - minAndSec = hourInSec;
  13. minAndSec % 60 = s;
  14. hourInSec / 3600 = h;
  15. minAndSec - s = minInSec;
  16. minInSec / 60 = m;
  17.  
  18. cout << "This corresponds to " << h << " hours, " << m << " minutes, and " << s << " seconds." << endln;
  19.  
  20. }
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:7:81: error: ‘endln’ was not declared in this scope
     cout << "This program converts seconds into hours, minutes and seconds." << endln;
                                                                                 ^
prog.cpp:11:14: error: lvalue required as left operand of assignment
     x % 3600 = minAndSec;
              ^
prog.cpp:12:19: error: lvalue required as left operand of assignment
     x - minAndSec = hourInSec;
                   ^
prog.cpp:13:20: error: lvalue required as left operand of assignment
     minAndSec % 60 = s;
                    ^
prog.cpp:14:22: error: lvalue required as left operand of assignment
     hourInSec / 3600 = h;
                      ^
prog.cpp:15:19: error: lvalue required as left operand of assignment
     minAndSec - s = minInSec;
                   ^
prog.cpp:16:19: error: lvalue required as left operand of assignment
     minInSec / 60 = m;
                   ^
stdout
Standard output is empty