0
Anyone know how i could program this to show an error message when someone tries to divide by zero?
Putting some finishing touches on a calculator https://code.sololearn.com/ccpxHZjOTaLd/?ref=app
3 Réponses
+ 2
Try this:
case '/':
if (num2==0) {
cout << "Error! Division by zero.";
}
else {
cout << num1/num2;
}
break;
+ 2
You're welcome! 😊
+ 1
Thanks for your help it worked