Write ONE C++ program that displays a menu with 4 choices and executes those choices for the end-user.
Your menu should include an informative header/description at the top of the Windows 32 console followed by the following menu text (written in bold here):
Choose one of the following, or choose to quit this program.
1. Display ASCII characters with codes from 32 to 256
2. Show two patterns using the '+' character
3. Read random numbers from a file and perform calculations on them
4. Quit
Your code compiles just fine, and it works perfectly UNTIL you get to option 3. If the file doesn't exist, the program will throw EXC_ARITHMETIC (divide by zero causes this).
Hi nano,
I am a beginner, so don't know how fine is my solution. But let me try. When I checked the code it seems like when it was not getting any input from random.txt, it was giving error because behavior of division by 0 is undefined in c++ and that is what code is trying to do.
I modified code a bit by throwing domain_error exception and it is working fine.