The discussion on this page is meant to assist you with designing your
solution - it is a guide on how to organize the program
Part 1 - Top level code; will become the final solution
- Write the code for the 4 menu options and get the option from the user
- Write a switch statement for the 4 options (the 4th option is to quit).
For each case, simply cout which option was chosen
- Test the code you wrote.
- Place the tested code inside a do while loop that ends when option 4 is
chosen
Your code should resemble
this code
- Test the code
Part 2 - Counting up code
- Start a new program
- Ask the user for the end number (N) and the increment (step)
- If N is below 1, output an error message, otherwise:
- Using a for loop, count from 1 to N by step
- Test your code
- Once it is working, copy the code into case 1 of the final solution
- Test the case 1 of the final solution
Part 3 - Counting down code
- Modify the code from part 2
- Using a for loop, count from N downto by step
- Test your code
- Once it is working, copy the code into case 2 of the final solution
- Test case 2 of the final solution
- Re-test case 1 of the final solution
Part 4 - Base 2 conversion
- Start a new program
- Request an integer number between 1 and 1,000 from the user
- If the number is out of range, output an error message. Otherwise
- Compute the binary equivalent of the number using
the code from class
- Test the code
- Once it is working, copy the code into case 3 of the final solution
- Test case 3 of the final solution
- Re-test case 1, and case 2 of the final solution