I am creating an oregon trail clone as a proof of concept type thing, and for some reason the loop of the function I determined before int main isn't looping, and just not doing anything.
using namespace std; int debuginput; string response; int loop = 0; void commands () { if (response == "cmd") { cout << "what would you like to do? type 'help' to get a list of commands." << endl; cin >> response; if (response == "start") { loop = 1; } else { loop = 0; } if (response == "test") { cout << "test"; } } } int main () { cin >> response; do { commands (); } while (loop == 0); /*-------------------------------------------------*/ } Basically, whenever I call the commands function to loop, I enter one command and it doesn't loop to let me put in another command.
loopvariable is set to1and it won't affect the loop.