#include <iostream>
usingnamespace std;
int main()
{
constint LH312 = 42;
constint CAS41 = 44;
constint KH133 = 38;
int room;
int amountOfPeople;
{//Gathers room number and amount of people
cout << "Choose a room" << endl;
cout << "1. Leigh Hall Room 312" << endl;
cout << "2. College of Arts and Sciences Room 41" << endl;
cout << "3. Kolbe Hall Room 133" << endl;
cout << "Option:";
cin >> room;
cout << "How many people are in the room?" << endl << "Number of People:";
cin >> amountOfPeople;
}
if (room == 1)
{
if (amountOfPeople <= LH312)
{
cout << "It is legal to hold your class";
}
else (amountOfPeople > LH312);
{
cout << "The amount of students exceeds the limit";
}
}
elseif (room == 2)
{
if (amountOfPeople <= CAS41)
{
cout << "It is legal to hold your class";
}
else (amountOfPeople > CAS41);
{
cout << "The amount of students exceeds the limit";
}
}
else (room == 3);
{
if (amountOfPeople <= KH133)
{
cout << "It is legal to hold your class";
}
else (amountOfPeople > KH133);
{
cout << "The amount of students exceeds the limit";
}
}
return 0;
}
#include <iostream>
usingnamespace std;
int main()
{
constint LH312 = 42;
constint CAS41 = 44;
constint KH133 = 38;
int room;
int amountOfPeople;
{//Gathers room number and amount of people
cout << "Choose a room" << endl;
cout << "1. Leigh Hall Room 312" << endl;
cout << "2. College of Arts and Sciences Room 41" << endl;
cout << "3. Kolbe Hall Room 133" << endl;
cout << "Option:";
cin >> room;
cout << "How many people are in the room?" << endl << "Number of People:";
cin >> amountOfPeople;
}
if (room == 1)
{
if (amountOfPeople <= LH312)
{
cout << "It is legal to hold your class";
}
else
{
cout << "The amount of students exceeds the limit";
}
}
elseif (room == 2)
{
if (amountOfPeople <= CAS41)
{
cout << "It is legal to hold your class";
}
else
{
cout << "The amount of students exceeds the limit";
}
}
else (room == 3);
{
if (amountOfPeople <= KH133)
{
cout << "It is legal to hold your class";
}
else
{
cout << "The amount of students exceeds the limit";
}
}
return 0;
}
switch(room){
case 1:
if (amountOfPeople <= LH312)
cout << "It is legal to hold your class";
else
cout << "The amount of students exceeds the limit";
break;
case 2:
if (amountOfPeople <= CAS41)
cout << "It is legal to hold your class";
else
cout << "The amount of students exceeds the limit";
break;
case 3:
if (amountOfPeople <= KH133)
cout << "It is legal to hold your class";
else
cout << "The amount of students exceeds the limit";
break;
default:
cout<<"The input was invalid!"<<endl;
}