char Oprt;
cout << "\nPlease enter first number: ";
cin >> num1;
cout << "Please enter second number: ";
cin >> num2;
cout << "Now please enter operator: ";
cin >> Oprt;
while (Oprt != '+' && Oprt != '-' && Oprt != '*' && Oprt != '/')
{
cout << "Wrong Operator please enter again: ";
cin >> Oprt;
}
When user writes something like 'ffsd' as input the loop cycles for as much times as there are characters written by user but what I want is my program to read only first symbol and ignore the rest.