This.
Not sure why that shows up like that it should be < and >
Indeed, you should include libraries(more specifically, header files), like iostream.
I don't get why you're separating blocks of code for no apparent reason in your main function. You also don't seem to keep consistency in your programming style. Here's what you're doing:
Code:
...
if (hrz>21)
{
cout<<"You are exceeding 21 semester hours"<<endl;
}
else if(hrz<12)
cout<<"You are taking less than 12 semester hours"<<endl;
...
{ // Why are you starting a new block?
if (room == 'R')
cout<<"Room Type : Regular : "<<regroom<<endl;
else if (room == 'A')
cout<<"Room Type : Air-Conditioned : "<<acroom<<endl;
}
I think when you copy-pasted your code, you lost all whitespace, hence the lack of indentation and other spaces.
Remember to keep your code readable. Comment it, but do so in an organized fashion.
About the assignment:
If you're going to compare a variable with multiple constants(looking at room, here), you're better off using the switch command. Here's an example of how to use it:
Code:
#include <iostream>
using namespace std;
int main(void)
{
char pew; // pew pew space lasers.
cout << "Hey, type a letter:";
cin >> pew;
switch (pew)
{
case 'A':
for (int i = 0; i < 10; i++)
cout << pew++;
cout << endl;
break; // Needed to get out of the switch structure.
case 'B': // Will continue to do what case 'C' does.
case 'C':
cout << "You typed either B or C. Now which one was it..." << endl;
break; // Outta here!
...
default:
cout << "I couldn't predict your movements!" << endl;
}
return 0;
}
You can find more convenient and useful ways to use it, but I guess that can help you understand the syntax.
EDIT: An observation to make: if you're using an IDE, its editor is likely going to indent the cases the same as your switch statement, regardless of you starting a new block of code. That is to do with the fact they're labels, not actual blocks of code, which will go indented. It's personal preference, however, I indent my cases when I do use switch.