i am doing a program where I have to input an equation and from there , there must be only 5 inputs from the keyboard if more than 5 inputs are done the pgm must display an error message. The program is as follows:
int var1, var2, result;
string eq, op;
cout << "Type the equation : ";
cin >> var1 >> op >> var2 >> eq >> result;
example if the user types the equation :
2 + 3 = 5 (5inputs)
but
2 + 3 = 0 + 5 ( invalid bcos more than 5 inputs r done)
how do I do the validation?
int var1, var2, result;
string eq, op;
cout << "Type the equation : ";
cin >> var1 >> op >> var2 >> eq >> result;
example if the user types the equation :
2 + 3 = 5 (5inputs)
but
2 + 3 = 0 + 5 ( invalid bcos more than 5 inputs r done)
how do I do the validation?
Comment