jeudi 29 janvier 2015

C++ if statements not returning


int main()
{
char command = 'a';
Monster Goblin;Goblin.HP = 5;Goblin.name = "Goblin";
if(command == 'a'){
cout<<"At the main Menu, what to do now? Enter H for a list of commands!"<< endl;
cin>>command;
switch(command)
{
case 'a':
cout<<"Going to the main menu!"<<endl;
command = 'a';
break;
case 'b':
cout<<"Going to command line B"<<endl;
command = 'b';
break;
case 'c':
cout<<"going to command line C"<<endl;
command = 'c';
break;
}

}
if(command == 'b')
{
cout<<"You made it to command line B"<<endl;
cout<<"Now lets try to make it go back to the MM!"<<endl;
command = 'a';
}
if (command == 'c')
{
cout<<"You made it to command line C"<<endl;
}


}


im trying to get it to when I enter b, it will output going to command line B and the other two lines and then return to the main menu, which is 'a', why is it not returning to the main menu if the command char equals 'a'?


Aucun commentaire:

Enregistrer un commentaire