1. The single apostrophes are only useful when using one character. Ie, 'die' has no meaning.
2. Placing a string within double quotes will resolve to the address of the string, so even that wont work.
3. When you switch a pointer to char, it is actually switching the address of the char buffer, not the contents of it. So you cannot really use a switch statement. Try this:
Code:
if (!lstrcmpi(x,"die"))
{
cout<<"That was stupid, You lose\n";
}
else if (!lstrcmpi(x,"fight"))
{
cout<<"You chose to stay and fight\n";
}
else
{
cout<<"That is not a valid command, Try again\n";
}
4. Use code tags please.
EDIT: I forgot to explain my code. lstrcmpi() compares the contents of the two specified char buffers and returns 0 if they are the same. It also returns other values but I wont get into that here. The code above is pretty much exactly the same as a switch statement, in terms of native code, but it's the only way to do it with char buffers.