#include <iostream>
#include <string>
#include <cstdlib>
usingnamespace std;
int main()
{
begin:
string name;
string surname;
int hp = 100;
int defense = 0;
int attack = 1;
int money = 100;
char arena [10] [10] = {0};
bool sword = 0;
int maxmana = 100;
int mana = 100;
bool male;
int answer;
int badgood = 0;
int luck;
cout << "enter your warriors first name" << endl;
cin >> name;
cout << "now their lastname" << endl;
cin >> surname;
system("CLS");
cout << "to begin this game you will be asked some basic questions" << endl;
cout << "are they a male?" << endl;
cin >> answer;
if (answer = 'yes');
{
male = "1";
attack = attack + 1;
}
if (answer = 'no');
{
male = "0";
defense = defense + 1;
}
system("CLS");
cout << "your enemy falls at your feet and offers his life" << endl;
cout << "A. you kill him with your trusty sword" << endl;
cout << "B. you make him your slave" << endl;
cout << "C. you free him" << endl;
cin >> answer;
if (answer = 'A')
{
sword = 1;
badgood = -10;
attack = attack + 1;
}
Also lets look at your code..
1) you are using goto I am assuming based on line 9.
2) 32 you ask if they are male but you are inputting to an int how is yes/no a number? Either input 1/0 for yes/no or change it to a string on line 21. If you change it to a string then you will not have to change line 34 or 40 too much.
3) Line 34 and 40 are strings not characters so you would put " around it and not '.
4) line 36 male is a boolean and you are trying to assign a string value to it.. If you really want to assign a number to make it true/false you would use 1 for true and 0 for false since booleans are really numbers. It would be best though if you just did male = true; or male = false; since booleans mainly take in true/false.
5) Line 54 you are using an int and trying to input a char. You may want to change the letters to numbers or have a second input variable that will take in the characters which I would recommend so you don't have to change line 56.
6) Some small fixes I would do is change line 17 to false not 0. line 37 , 43 , and 60 you can change to ++varaible; or varaible += 1; instead of variable = variable + 1;
The reason it crashes is because when you put a string where a number is supposed to be in the input buffer it will put the other chracters into the next inputs which will then crash it since you are not clearing/ignoring the failed inputs.
*edit also don't put semicolons after if statements.
**edit 2 looks like disch beat me to that.
***edit 3 also please don't pm me saying "Still won't work." If you're going to pm at least ask a question don't just tell me that my answer to earlier didn't work when in all reality it did work its just your code is a complete mess.