However, it is impossible to say without more context why there would be observable difference.
Besides. "doesn't work" doesn't tell what doesn't work. There are many different ways that things "do not work", and if you don't tell the details neither we nor you can diagnose the issue.
#include <iostream>
#include <fstream>
usingnamespace std;
int getInput();
int main(){
int input;
input = getInput();
while(input != 4){
int input = getInput();
}
return 0;
}
int getInput(){
int choice;
cout << "1 - current items" << endl;
cout << "2 - helpful items" << endl;
cout << "3 - harmful items" << endl;
cout << "4 - quit" << endl;
cin >> choice;
return choice;
}
Somehow I fixed variable error but now I have a new problem. When my program starts, and I press 4, it quits. But when my program starts and I press other numbers first and then press 4, It won't quit.