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

10th Dec 2018, 2:14 AM
Lucky Gamer
Lucky Gamer - avatar
3 Respostas
+ 2
Try this: case '/': if (num2==0) { cout << "Error! Division by zero."; } else { cout << num1/num2; } break;
10th Dec 2018, 3:09 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 2
You're welcome! 😊
10th Dec 2018, 3:44 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 1
Thanks for your help it worked
10th Dec 2018, 3:32 AM
Lucky Gamer
Lucky Gamer - avatar