If room is a vector, then you should consider using push_back. Depending on whether you want rooms to exist without customers, either solution may be preferable.
Type: Posts; User: Elysia
If room is a vector, then you should consider using push_back. Depending on whether you want rooms to exist without customers, either solution may be preferable.
>>ifstream infile;
>>infile.open("input.txt");
Simplify to
ifstream infile("input.txt");
>>if (infile.is_open)
Don't forget parenthesises!
if (infile.is_open())
>>while (infile.eof() ==...
Switch statement requires braces:
switch (expr)
{
case A:
case B:
// etc
}
You probably want to pass your room by const reference, also.
There are two problems:
- The first is that you declared the function as bool isSmoking (int n), but defined it as IsSmoking (notice the leading capital letter). Remember that C++ is case sensitive!...
What error?
Btw, your code basically boils down to:
bool IsSmoking (int n) { return (n <= 20); }