I have a similar while loop to the one below I have looked all over does anyone know? A break statement has to be used within the loop itself that I have figured but what possible ways are there to exit a while loop from a function call as I can't seem to find any, is it possible or do I just go for a do while loop instead.
#include <iostream>
using namespace std;
int someinput=1;
int state=2;
void ifcondtionismetbreak(int x){
if (x == 1)
{
// EXIT WHILE LOOP SOLUTION
}
else
{
cout <<"Continue";
}
}
int main() {
while (state==2){
cout << "This was Printed\n";
ifcondtionismetbreak(someinput);
cout << "Don't Print This When Condition Wants to Exit Loop\n";
}
return 0;
}