C++:Problem7

Problem:
Write a program that determines whether a meeting room is in violation of fire law regulations regarding the maximum room capacity. The program will read in the maximum room capacity and the number of people to attend the meeting. If the number of people is less than or equal to the maximum room capacity, the program announces that it is legal to hold the meeting and tells how many additional people may legally attend. If the number of people exceeds the maximum room capacity, the program announces that the meeting cannot be held as planned due to fire regulations and tells how many people must be excluded in order to meet the fire regulations. Write your program so that it allows the calculation to be repeated as often as the user wishes.

Objective:
• If-else statement
• Boolean expression
• Determine the logical data types for variables
• Using a do-while loop

Display:
Enter the room capacity :25
Enter number of people in the meeting :30
Warning! you can't hold the meeting. But if you still want to hold
the meeting you have to exclude: 5 guest(s)
Do you want to run the program again? y/n Y


Enter the room capacity :25
Enter number of people in the meeting :25
You can hold the meeting legelly!
Do you want to run the program again? y/n y


Enter the room capacity :55
Enter number of people in the meeting :25
You can hold the meeting legelly!
Do you want to run the program again? y/n n



End of Program

Code:
#include
using namespace std;

int main ()
{
//declaration of variables
int number;
int roomcapacity;
char choice ;

//Using do while loop and if-else statment
do
{
cout << "Enter the room capacity :";
cin >> roomcapacity;
cout << "Enter number of people in the meeting :";
cin >> number;


if(number <= roomcapacity)
cout << "You can hold the meeting legelly!";
else if (number > roomcapacity)
{
cout <<"Warning! you can't hold the meeting. But if you still want to hold" < <<"the meeting you have to exclude: " << (number - roomcapacity) << " guest(s)";
}

cout << endl << "Do you want to run the program again? y/n ";
cin >> choice;
cout << endl << endl;
}
while ( choice =='y' || choice == 'Y');

//closing
cout << "\nEnd of Program\n\n";
return 0;
}