Hi.. for some reason im getting a parse error for this section:
#include <iostream>
using namespace std;
int main()
{
const int MAXIMUM = 30;//people
int num_people;
cout << "Enter the amount of people attending the meeting: ";
cin >> num_people;
{
cout << "The meeting cannot be held as planned due to fire regulations.\n";
cout << "Please exclude" << (num_people > MAXIMUM) << "people.\n";
}
else
{
cout << "It is legal to hold the meeting.\n";
cout << "An additional" << (MAXIMUM - num_people) << "people may attend the meeting.\n";
}
return 0;
}
im getting the errors before 'else' and 'return' aslso it is saying something is wrong with 'int main()'
PLEASE HELP!!
Parse Error causing trouble
Moderator: General Moderators
-
Cruzado_Mainfrm
- Forum Contributor
- Posts: 346
- Joined: Sun Jun 15, 2003 11:22 pm
- Location: Miami, FL
moved to Miscellaneous since this is a c++ related topic.
The compiler is right, there's no if for the else-statement
Probably a copy&paste-error. The code (somehow) makes sense as
The compiler is right, there's no if for the else-statement
Probably a copy&paste-error. The code (somehow) makes sense as
Code: Select all
#include <iostream>
using namespace std;
int main()
{
const int MAXIMUM = 30;//people
int num_people;
cout << "Enter the amount of people attending the meeting: ";
cin >> num_people;
if (num_people > MAXIMUM)
{
cout << "The meeting cannot be held as planned due to fire regulations.\n";
cout << "Please exclude " << (num_people - MAXIMUM) << " people.\n";
}
else
{
cout << "It is legal to hold the meeting.\n";
cout << "An additional " << (MAXIMUM - num_people) << " people may attend the meeting.\n";
}
return 0;
}