ok im trying to make a video game for school medterm.. problem is it runs the females and male selection when it shouldnt... is this a syntax error or code error.. what can i do to fix it??
#include <iostream.h>
#include <iomanip.h>
#include <cstdlib>
main()
{
char gender;
char option;
char race;
int hp;
cout << "Please choose your gender(M/F). ";
cin >> gender;
switch(gender)
{
case 'M':
cout << "You have chosen a male character. \n";
cout << "Please choose your class.(Mage,Fighter,Archer.[M,F,A]) ";
cin >> race;
switch(race)
{ //start of male race switch
case 'M':
cout << "You have chosen the Mage. ";
hp = 75;
break;
case 'F':
cout << "You have chosen the Fighter. ";
hp = 120;
break;
case 'A':
cout << "You have chosen the Archer. ";
hp = 100;
break;
}//end of male race switch
break;
case 'F':
cout << "You have chosen a female character.\n ";
cout << "Please choose your class.(Mage,Fighter,Archer.[M,F,A]) ";
cin >> race;
switch(race)
{//start of female race switch
case 'M':
cout << "You have chosen the Mage. ";
hp = 75;
break;
case 'F':
cout << "You have chosen the Fighter. ";
hp = 120;
break;
case 'A':
cout << "You have chosen the Archer. ";
hp = 100;
break;
}//end of F race switch
break;
}//end of Gender
switch(option)
{
case 'A':
break;
case 'M':
break;
case 'I':
break;
case 'R':
break;
}
//http://www.daniweb.com/techtalkforums/thread1769.html for random generator in range;
system("PAUSE");
return 0;
}