Hey everyone, I'm running a bit behind in class and I feel like I've almost finished this program. If anyone could point me to the right direction in getting this fixed, it'd be most appreciated.
Edit: I almost forgot to describe it. I need to write a program that allows the user to input a value and a capacity equal to the amount a room can hold. If the amount of people is too much for how big the room is, then it will say so.
#include <iostream>
usingnamespace std;
int main( )
{
int people;
int capacity;
int answer;
do{
cout << "Enter the amount of people: ";
cin >> people;
cout << "Enter the room capacity: ";
cin >> capacity;
if (people >= capacity)
{
cout << "Meeting cannot be held.\n";
cout << "(capacity - people) need to be removed.\n";
}
else
{
cout << "Meeting can be held.\n";
cout << "(capacity - people) more people can be added.\n";
}
cout << "Again? (y or n): ";
cin >> answer;
} while(ans == 'y' || ans == 'Y');
system("PAUSE");
return 0;
}
I suppose the program would state that it's still okay for that amount of people to be in the room. As long as it doesn't go over whatever the limit stated is, it should be fine.
Yeah, I'm not sure why I didn't catch the "ans" not being declared, I fixed it and the program is working now for the most part. However, now the problem seems to be that it wont say how many people can be added or need to be removed.
Also TheIdeasMan, if I use that method for quiting out of the program in clase, then my teacher wont believe I done it and will give me a 0. It happend to me earlier in the year when I had someone help me, they showed me how to incorporate arrays and she gave me a 0 for it. It's a pain.
Well that sucks, you cannot demonstrate a better way of doing things, and are forced to stagnate with whatever the teacher deems as being suitable.
I guess she is trying to stop cheats - I suppose the only thing to do is declare to her that you belong to this forum. As long as she can see we haven't done you homework for you, it might be OK. The downsides are: She might not be bothered with that ( busy enough already); She will see what you didn't know.
However, now the problem seems to be that it wont say how many people can be added or need to be removed.
TheIdeasMan wrote:
The program does not calculate the number of people to be removed / added because your hint is inside the quotes.
You need to have those as separate statements with some more variables.
Yeah, it does suck and not only that but whenever I ask for assistance, she tells me "I believe students will figure out how to do it on their own," or even say "Yeah there are problems that need to be fixed."
I feel like she doesn't even care if I pass or fail her class, which is terrible because this is the last class I need to earn my certificate.