tell me if i'm wrong but something strange happend
Ok i made a class named alarm
the constructer takes threee values as follows:
Code:
Alarm(int amount, TYPE type, ROOM room);
and before this i have:
Code:
enum TYPE {FIRE, BURGLAR, WINDOW};
enum ROOM {KITCHEN, LIVING, BED1, BED2, BED3, COMPUTER, BATH1, BATH2};
now as i understand it each one of these enum things has a number starting at 0.
So i made a function which would tell me where the alarm is and what type it is:
Code:
void make(int amount, int type, int room)
{
cout<<amount<<" ";
switch(type)
{
case 0:
cout<<"fire";
break;
case 1:
cout<<"burglar";
break;
case 2:
cout<<"window";
break;
}
cout<<" alarms where installed in the ";
switch(room)
{
case 0:
cout<<"kitchen.";
break;
case 1:
cout<<"living room.";
break;
case 2-4:
cout<<"bed room.";
break;
case 5:
cout<<"computer room.";
break;
case 6-7:
cout<<"bathroom.";
break;
}
cout<<"\n";
}
now what is going wrong is that no matter what i pass to the constructor it allways gives me burglar alarm but the rest works fine so i thought hey thats weird and before we call the function make() i put
Code:
cout<<comp.getType();
//yes i have made an instance of alarm named comp
and its always one even if i make a constructer like so
Code:
Alarm kit(2, FIRE, KITCHEN);
please tell me its a stupid mistake in the program I've gone nuts!!