Trouble with If's and Else's
Kay, so I'm working on a text RPG, and I ran into a snag that if I try to use a CHAR as a string (by making an array out of it) I can't compile, this is my code for initilizing my CHAR ARRAY:
And this is for reading it off:
Code:
if (input=="left") {x=x-1;} //Go Left
else if (input=="right") {x=x+1;} //Go Right
else if (input=="north") {y=y+1;} //Go North
else if (input=="south") {y=y-1;} //Go South
else if (input=="jump") {if (rope_above==true) {z=z+1;} else cout<< "Nothing above me\n";//Jump up, if a rope is above, grab it
else if (input=="dig") {if (hole_below==true) {z=z-1;} else cout<< "Nothing below me\n";//Dig if you can
I am using Dev-C++ and I get this error:
Quote:
18 C:\Documents and Settings\Glitchguy2\Desktop\My Creations\Text Based Games\directions.h ISO C++ forbids comparison between pointer and integer
Where it says "left" is what the action depends on, such as typing left to make x equal itself minus 1.
Note that I am fairly experienced with C++ console game programming, but no where near the best.
NOTE: These codes both take place in seperate HEADER files, however they do convers properly I think.