can someone help me fix the while loop in my program. What i want it to do is to ask the user input the operation until it is either "+","-,"*","/". "operation is a constant char.
1 2 3 4 5 6 7
while (operation=='+','-','*','/')
{ cout<< "You have chosen" <<operation;
else {
cout<< "Wrong operation please enter again";
cin >> operation;
}
Put the ! operator outside of the condition (i.e. !(operation == 'x')). The way it is now, you're not checking if operation is not equal to the character; you're checking if the opposite of operation (which is gonna be false, assuming operation isn't 0) is equal to the character.