I was wondering on how to make a if statement repeat back to itself using a bit of code such as:
1 2 3 4 5 6 7 8 9 10 11 12
int x = 0;
while(x > -5){
//bit of code I do not know
cin >> x;
if (x > 15){
cout << "Hola" << endl;
}elseif(x > 10){
cout << "Hello" << endl;
}else{
//line of code which reverts to the code I don't know if they enter a invalid piece of code
}
}
That if statement would repeat itself until x is less than -5. As it stands, it would read in an int, then do something based on the int, either saying Hola or Hello.
I'm not sure what exactly you're looking for, but that loop will keep running unless you escape it.