lundi 12 juillet 2021

Basic Switch case statement for calculator [closed]

 case '%': 
           bool isNum1Int, isNum2Int;
           isNum1Int=((int)num1==num1);
           isNum2Int=((int)num2==num2);

            if (isNum1Int && isNum2Int);
             cout<<num1 << operation << num2 << "=" << int(num1) % int(num2);
            else
                 cout<<"\nNot Valid!!"
                break;

This is the case for modulo function. I have tried first checking whether the numbers are integers are not if yes then perform the modulo operation. else printing "not valid ". But the else part is giving an error saying expecting a statement.This is the image of whole switch case

Aucun commentaire:

Enregistrer un commentaire