Independent and ambiguous variables

Ok so how do i make variables that are not part of any function but can be changed by other functions in the program....im trying to write a text game and i need this so i can have the inventory values per se i wanted the following:
1
2
bool knife = "false";
bool key = "false";

to run properly outside of a function
Put them outside of all functions and on top of them. Then you can access them in any function from that code file.
That seems the logical answer but this code
string currentroom = "outside";
when refernced with this code
1
2
3
if (currentroom == "oustide")
	{cout << "hi";}
else {cout << "error";}

always returns error....
and yes the string declaration is at the begining
Last edited on
Unless it's a typo in your post and not in your code, you are comparing outside to oustide, which will indeed output error.
Topic archived. No new replies allowed.