I have a function with a while loop and some if statements in it, everything runs as expected, however, when the If statements run, they dont terminate the function after returning a value.
vector<int> select() {
vector<int> select_control;
int select;
cin >> select;
while (select < 10) {
//SOME CODE THAT PUSHES VALUES INTO THE VECTOR select_control
}
if (select == 99){
cout << "TERMINATING";
Sleep(3000);
exit(0);
}
else if (select == 100) {
cout << "input complete";
return select_control;
}
else {
cout << "not a valid value";
}
}
Aucun commentaire:
Enregistrer un commentaire