cout<<"Please choose your operation";
while ( check<1 )
cout<<" Sorry you have not choosen the right operation. Please choose either; +, -, *, and /.";
the problem is I want the while loop to loop the whole block not just repeat the else when there is a wrong operation. If someone where to click something wrong the while loops just keeps loop else infinitely instead of looping the whole thing all over again. I would like to know why it doesn't loop the whole thing.
look at your code:
You enter, for example, ! when asced about operation. now your operation variable contains !.
Now you checking if check<1. It does, so you going to if statement. It is false because ! does not equals + so else statement is executed. It will prit long line and thend last statement in while loop. It prints 0, and loop begins anew. Checking if check<1... passs, checking if operation equals +... Wait! operation still contains ! because we didn't bother to change it inside the loop! so it will eternally check if ! equals +, fail and try again on next iteration...