Question: Count Down Overview For this daily, write a program that will display values counting down from N through 1, inclusive, on one line. A CPP
Count Down Overview For this daily, write a program that will display values counting down from N through 1, inclusive, on one line. A CPP file (countdown.cpp) has been provided. It contains the declaration for an integer variable (N) and code that will ask the user to enter an integer value. Add code that will check the N value for validity. To be valid, the N value must be greater than or equal to 1. If an invalid N value is entered, display an error message and ask the user for a new N value. This should continue until a valid N value is entered. The error message displayed to the user MUST match the message that is displayed in the output below. Once a valid N value has been entered, write a loop that will display the values N through 1 on one line. Each value should be displayed right justified in a field that is three (3) spaces wide. Print a new line before the loop that displays the values N through 1 and at the end of the output. File You Must Submit Place the completed program code in a source file named countdown.cpp Output The output that is produced by the program will vary based on the values that are entered when the program is executed. The output that is shown below is what the program will produce when it is run in an environment such as Dev C++ or XCode. When it is run through the Auto Grader, the portion that asks for the integer value and the error WILL NOT show the value that is entered. This is used to produce the output for diff 1: N value (must be greater than or equal to 1)? 15 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 This is used to produce the output for diff 4: N value (must be greater than or equal to 1)? 0 Error: the N-value must be greater than or equal to 1. Try again: -9 Error: the N-value must be greater than or equal to 1. Try again: -6 Error: the N-value must be greater than or equal to 1. Try again: 0 Error: the N-value must be greater than or equal to 1. Try again: 10 10 9 8 7 6 5 4 3 2 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
