Hlpz wth vriablz plz

John Smith H and S's Avatar, Join Date: Nov 2010
Newbie Member

I is mad 'bout mah coad. Here it is:

#include <iostream>

using namespace std;

int main()
{
int iPalooza, iFlyingMonkeyMana, iFlyingMonkeyHealth, iFlyingMonkeyDamage;
char cCommand [10];
cout << "A flying monkey lunges at you. ";
cout << "What do you do? ";
cin >> cCommand;
if (cCommand == "a")
{cout << "thx";}
if (cCommand == "s")
{cout << "K";}
if (cCommand == "d")
{cout << "bai";}
}


Ignorinz teh unuzed varablz, it sez that i cannot compare integers wif charactres. Wai?
John Smith H and S's Avatar, Join Date: Nov 2010
Newbie Member
In other words, I need help because the program will not allow me to compare character sequences and integers.
John Smith H and S's Avatar, Join Date: Nov 2010
Newbie Member
Hello? Anyone?
jimblumberg's Avatar
Ambitious contributor
Code:
if (cCommand == "a")
To compare two cstrings ymu strcmp();

Jim