If/Else Statements

I'm having so much trouble with this assignment. I need to create a program that asks the user to enter the number of minutes they were parked in a parking garage. If the user enter a 0 - i need to dispaly a message that says enter a valid number. Then I will need to convert the minutes to hours and remainder of hours. Then figure out how much the user will need to pay for parking. This is what I have so far. I;m getting an error message on the first if statement is says its undeclared. Any help will be apprciated.

#include <cstdlib>

#include <iomanip>

#include <iostream>
using namespace std;

int main()
{

//Clear the screen
system("cls");

int NumberOfMins; //number of minutes in parking garage
int minutesToHours; ///converts minutes to hours
int minutesToRemainingMinutes; //converts remaining minutes

//Prompt User to enter minutes in parking garage
cout <<"Please enter the number of minutes in the parking garage:" << endl;
cin >> NumberOfMins;



IF (NumberOfMins<=0) //if minutes equals 0
{ //beginning of nested IF
cout <<"You must enter a valid number of minutes:" << endl;
} //ending of nested if

ELSE
{ //beginning of nested ELSE
(NumberOfMins>0)
;minutesToHours = NumberOfMins/60;
cout << "The Number of Hours is " minutesToHours;<< endl;
} //ending of nested if

ELSE
{ //condition 1 and 2 is false
(NumberOfMins>0)
minutesToRemainingMinutes = NumberOfMins%60;
cout << "The Remaining minutes is " << minutesToRemainingMinutes << endl;

}

system("PAUSE");
return 0;



//End main
Last edited on
IF (NumberOfMins<=0)
The keyword in C++ is if, like this
if (NumberOfMins<=0)
Topic archived. No new replies allowed.