Anyone who knows programming in C++ that wants to make 40 dollars

make another variable to show how many people can be added to the meeting still

change the if statement to show its LESS than or equal to capacity, you have greater than

under the same statement take the new variable and set it equal to capacity - people

cout

 
Been a while since I've done C++, but this should work fine:

Code:
#include <iostream>
using namespace std;

int main()
{

int people;
int capacity;
int diff;

cout << "Please enter the number of people attending:";
cin >> people;
cout << "Please enter the maximum number of people who can legally attend:";
cin >> capacity;

if (people < capacity)
 diff = capacity - people;
 cout << "You may hold the meeting.  An additional " << diff << " people may attend." << endl;
else
 diff = people - capacity;
 cout << "You may not hold the meeting as you are above the room capacity." << endl;
 cout << "You must remove " << diff << " people from the room." << endl;

return 0;
}
 
thomas% g++ project2.cpp

project2.cpp: In function `int main()':

project2.cpp:19: error: expected primary-expression before "else"

project2.cpp:19: error: expected `;' before "else"

thats what i got n i not sure how to fix that if u can do that ill b needing ur paypal.

 
Well it's not worth $40 for a program so simple. Do me a favour and donate your $40 to a worthy cause.

The problems you mention are simple syntax errors. Clean those up and your program will work fine.

 
The best would be to buy some baby food and drop it off at your local food bank. Aside from that, try to find something that will help a kid (Make A Wish, Feed the Children, etc.).

 
Activity
No one is currently typing a reply...

About this thread

jeeper07

5,000+ posts
Rebuilding&Reconstruc ting
Thread starter
jeeper07
Joined
Location
Indianapolis, IN
Start date
Participants
Who Replied
Replies
11
Views
186
Last reply date
Last reply from
HeadCase
IMG_20260516_193114554_HDR.jpg

sherbanater

    May 16, 2026
  • 0
  • 0
IMG_20260516_192955471_HDR.jpg

sherbanater

    May 16, 2026
  • 0
  • 0

New threads

Top