rendered paste bodyvoid frac_input(int &num1, int &den1, int &num2, int &den2, char &oper){
char trash;
bool valid;
do{
valid = true;
cout << "Enter like this: 4 / 2 + 3 / 3: ";
cin >>num1>>trash>>den1>>oper>>num2>>trash>>den2;
if(den1 == 0 || den2 == 0){
valid = false;
cout << "Denominator is zero. please retry." << endl;
}
if(!(isdigit(char(num1+48)) && isdigit(char(num2+48)) && isdigit(char(den1 + 48)) && isdigit(char(den2 + 48)))){
valid = false;
cout << "Please enter only numbers." << endl;
}
if(oper != '*' && oper != '/' && oper != '+' && oper != '-'){
valid = false;
cout << "Invalid operator. please retry. " << endl;
}
} while (valid == false);
}