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

3 Answers

+ 3

do a while loop
while(base <1 || perp <1){
cin>>base
cin>>perp
}

+ 1

Can you show us your code? That would help greatly.

0

You should use try/throw/catch in your program