Question: #include using namespace std; //constant for HOURS, MINUTES and SECONDS. const int HOURS = 24; const int MINUTES = 60; const int SECONDS = 60;
#include using namespace std; //constant for HOURS, MINUTES and SECONDS. const int HOURS = 24; const int MINUTES = 60; const int SECONDS = 60;
int main() { //Declare variables. long inSec, inMin, inHrs; int sec; int min; int hrs; int dayz; cin >> inSec; cout << "Total seconds: " << inSec << endl << endl; if (inSec < 0) cout << "Total seconds must be greater than zero" << endl; else sec = inSec % SECONDS; inMin = inSec / SECONDS; min = inMin % MINUTES; inHrs = inMin / MINUTES; hrs = inHrs % HOURS; dayz = inHrs / HOURS;
if (dayz > 0) cout << dayz << " day(s)" << endl; if (hrs > 0) cout << hrs << " hour(s)" << endl; if (min > 0) cout << min << " minute(s)" << endl; if (sec > 0) cout << sec << " second(s)" << endl; cin.get(); cin.get(); return 0; } //End function main
This is what I have so far. And here are the errors shown in lab.
Already solved. No need answer
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
