All pastes #637773 Raw Edit

SecondsProgram

public cpp v1 · immutable
#637773 ·published 2007-07-29 05:55 UTC
rendered paste body
// This program asks the user to enter a number of seconds.  If the number of seconds is greater than// 60, the program should display the number of minutes in that many seconds.  If the number of seconds is// greater than 3,600, the output should be shown in hours.  If the number of seconds is greater than// 86,400 the output should be shown in days.#include <iostream>#include <iomanip>#include <windows.h>using namespace std;int main(){    // Declare variables    double seconds, minutes, hours, days;        // Get the number of seconds from the user    cout << "Please enter a number of seconds." << endl;    cin >> seconds;        // Set precision    cout << fixed << showpoint << setprecision(2);        if (seconds > 60 && seconds < 3600)    {                minutes = (seconds / 60);                cout << "You entered a total of: " << minutes << " minutes" << endl;    }        else if(seconds > 3600 && seconds < 86400)    {         hours = (seconds / 3600);         cout << "You entered a total of: " << hours << " hours." << endl;    }        else if(seconds > 86400);    {         days = (seconds / 86400);         cout << "You entered a total of: " << days << " days." << endl;    }        // Set the sleeper timer    Sleep(60000);    return 0;}         // This program seems to fall through and its driving me crazy.  It'll skip any value// it doesn't qualify for but it displays the if statements that follow it.  If seconds > 3600, // it'll display the time in hours and then display it in days too.// BAT SHIT CRAZY