Count
Overview
For this daily, write a program that will display values from 1 through N, inclusive, one value per line.
A CPP file (count.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. If an invalid N value was 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 numbers 1 through N, one number per
line.
Print a new line at the end of the output.
File You Must Submit
Place the program code in a source file named count.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
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)? 7
1
2
3
4
5
6
7
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: -7
Error: the N-value must be greater than or equal to 1. Try again: -12
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: 9
1
2
3
4
5
6
7
8
9