   consecutive loop problem
  hi guys i need help i have created my game with functions and i have created the main game loop and it doesn't work... the problem with it is that it just keep repeating itself and doesn't take the input from the combat options can someone please help :D#include <iostream>// different functionsvoid intro();void combat();// global variablesint monster_health = 50;int player_health = 100;int main(){using namespace std;cout << " Welcome to the text based game Warriors of Troy! \n";intro();combat();cin.get();return 0;}void intro(){char name[20];using namespace std;cout << " to begin please enter your name! \n";cin >> name;cout << " hello and welcome : " << name << "\n";cin.get();cin.get();}void combat(){using namespace std;while(monster_health > 1){int choice;cout << " you are walking down the road to the city "<< " and suddely you are attacked by a wild boar! ";cout << endl;cout << " what do you do? " << endl<< "1) crushing blow " << endl<< "2) accurate lunge " << endl<< "3) quick lunge " << endl;cin >> choice;switch(choice){case '1' :cout << " Crushing blow !";monster_health = monster_health - 20;cout << " the monster now has :" << monster_health<< " health! ";break;case '2' :cout << " Accurate lunge! ";monster_health = monster_health - 15;cout << " the monster now has :" << monster_health<< " health! ";break;case '3' :cout << " quick lunge! ";monster_health = monster_health - 10;cout << " the monster now has :" << monster_health<< " health! ";break;default :cout << " you have entered an unavailable option! ";break;}};}
  What have you done so far to try to locate the problem? :) Have you used the debugger at all?   ;  there is no bugs found   ;  I'm not great with basic C++ but does cin >> choice return a number or a char?  It looks like it's defined as an int but is reading in as a char.  This won't fix your looping issue though.  From what I see it should be pausing at every one of your cin statements.I'd try testing it but I'm at work.   ;Quote:Original post by emforcethere is no bugs foundI don't think you understand. The debugger is a program that allows you to control the execution of your program. You can pause it, inspect the values of variables, jump into and out of functions. Read more here.I will give you a hint. Your variable "choice" is of type int. The constant '1', '2' and '3' are char literals. Finally, the value of the integer 1 doesn't match the value of the character '1'.   ;  lol now i feel like such a noob :P thanks alot!   