I have declared a variable in my .h file like this:
char c;
This should, in my mind, declare a variable called c as a character. I have then used it like this in my .cpp file:
c = tolower(getchar());
if (c = “w”){move forward}
else if (c = “a”){move left}
else if (c = “s”){move down}
else if (c = “d”){move right}
I have actual code instead of all the moves.
For some reason, it doesn’t like all the "c = " bits inside the if statements. Why is this and how would I fix it? I have used all the following includes, I don’t think I’m missing any:
That made it work, thank you! Glad I got that solved, now I just need to figure out what’s going on with the compiler. It seems to freak out and give me loads of errors that just aren’t errors.
The newest problem is that it’s giving me about 50 errors when I compile, none of which actually exist, which means I can’t check if the code works properly or not. I’ll post another question about it soon.