Hey im just trying to make a simple game to impress my dad because i want to but i get this error "warning: multi-character character constant". Any help? (btw: I need help stat)
Its a game where you go left, right, up, or down and if your lucky you get a apple. Could someone do a little clean up I think this thing will have some issues. I also wanna know if someone can happen to put in some code that allows me to type inventory and see how many apples I have.
I don't know what you think if (move = 'left') is supposed to do. But it's not C++ ;o)
If you want to test if things are equal, you need to use double = like this if(a == b).
'left' is not a character nor is it a key code. You probably want to do something like if (move == 'l') and use the characters l, r, u, d for left, right, up, down respectively.
For the inventory you could use a std::vector<> and every time you get an apple (or whatever) add it to the back of the vector. When the user types in 'i' you could list what is in the std::vector:
#include <vector>
// ... etc..
int main()
{
// define your inventory as a vector of strings
std::vector<std::string> inv;
// ... stuff
// Add an item to the inventory like this:
inv.push_back("apple");
// print out the inventory like this
for(size_t i = 0; i < inv.size(); ++i)
{
std::cout << inv[i] << '\n';
}
}