0

The zero error

i am trying to make a program using functions which finds the hypotenuse if u input the length of the base and the perpendicular. however, if u give the length of either the base or the perpendicular equal to 0, it still gives u the hypotenuse. I want the program to say that the length of the base or the perpendicular can't be 0 and then go back to asking the base and the perpendicular. please help

31st Dec 2016, 3:12 PM
Blake12
Blake12 - avatar
3 Réponses
+ 3
do a while loop while(base <1 || perp <1){ cin>>base cin>>perp }
31st Dec 2016, 3:30 PM
Nahuel
Nahuel - avatar
+ 1
Can you show us your code? That would help greatly.
31st Dec 2016, 3:28 PM
James Durand
James Durand - avatar
0
You should use try/throw/catch in your program
31st Dec 2016, 10:29 PM
Shiv Kumar
Shiv Kumar - avatar