Originally Posted by
Norm
The current code will not all you to enter invalid data. Is that what you want it to do?
Do you know how to code a try{}catch block to catch the error?
No I dont know how to catch the error. I just want to create a while loop that prints a message saying Error invalid entry until they input a valid integer.
Example:
How many disks should we use for Hanoi problem: -4
Invalid! Input must be greater than 0.
How many disks should we use for Hanoi problem: 7 dfgdfg dgdfgd
EXCEPTION: Invalid input.
How many disks should we use for Hanoi problem: sdfdfsdf
EXCEPTION: Invalid input.
How many disks should we use for Hanoi problem: 0
Invalid! Input must be greater than 0.