Please help!!!

The 1o1, 1o2, 1o3, and 104 for some reason are not working, if somebody can see my mistake and point it out i would be very grateful, because I am failing to see it,
Thanks much.


#include <iostream>
#include <stdlib.h>
using namespace std;

int main()
{

int roomnum =0 ;

cout << "What's the room number?: ";

cin >> roomnum ;

roomnum = toupper(roomnum );

switch (roomnum)

{
case 101 : cout << "amenities: 1 king sized bed" << endl ;

break;
case 102 :
case 103 :
case 104 : cout << "amenities: 2 double beds" << endl ;
break;


case 201 : cout << "amenities: 1 queen size bed " << endl ;

break;
case 202 : cout << "amenities: 1 queen size bed " << endl ;

break;
case 203 : cout << "amenities: 1 double bed and 1 sofa bed" << endl ;

break;

default: cout << " Invalid room number "<< endl ;



}

system("pause");

return 0;

}
>>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <stdlib.h>
using namespace std;

int main()
{

int roomnum =0 ;

cout << "What's the room number?: ";

cin >> roomnum ;

roomnum = toupper(roomnum );

switch (roomnum)

{
case 101 : cout << "amenities: 1 king sized bed" << endl ;

break;
case 102 :
case 103 :
case 104 : cout << "amenities: 2 double beds" << endl ;
break;


case 201 : cout << "amenities: 1 queen size bed " << endl ;

break;
case 202 : cout << "amenities: 1 queen size bed " << endl ;

break;
case 203 : cout << "amenities: 1 double bed and 1 sofa bed" << endl ; 

break;

default: cout << " Invalid room number "<< endl ;



}

system("pause"); 

return 0;

}


Use [ code ] [ / code ] tags.

But firstly, where is the actual code for case 102 and 103 ?

Secondly, why would you use the toupper() function, if the declared variable is an integer ? Integers have no lower/upper case.
Last edited on
You declared roomnum as integer thus you must input integer value to it. For instance, you cannot enter 1o2(one 'o' two) in place of 102 (one zero two). If you do so it will obviously be a runtime error. Because you are trying to put a character to an integer variable.
Last edited on
Got it. Thank you so much. I appreciate it
Topic archived. No new replies allowed.