Ok i made a class named alarm
the constructer takes threee values as follows:
and before this i have:Code:Alarm(int amount, TYPE type, ROOM room);
now as i understand it each one of these enum things has a number starting at 0.Code:enum TYPE {FIRE, BURGLAR, WINDOW}; enum ROOM {KITCHEN, LIVING, BED1, BED2, BED3, COMPUTER, BATH1, BATH2};
So i made a function which would tell me where the alarm is and what type it is:
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 putCode: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"; }
and its always one even if i make a constructer like soCode:cout<<comp.getType(); //yes i have made an instance of alarm named comp
please tell me its a stupid mistake in the program I've gone nuts!!Code:Alarm kit(2, FIRE, KITCHEN);



LinkBack URL
About LinkBacks



???