- Personal identifying information. (name, class, ...)
- A high level description of the problem.
Given a set of problems with a start, end and skip value, count from the starting value to the ending value skipping by the skip value.
- A list of questions about the problem.
- A description of the problem's input/output.
Input:
A valid file name.
For each case in the file
The case description
Start, stop and end value
Output:
For each case:
The case description
The proper count.
- A set of test cases, both input and output.
Easy, what everyone knows how to do! |
1,5,1 | 1, 2, 3, 4, 5 |
Can you count down? |
5,1,1 | 5, 4, 3, 2, 1 |
Can you skip by 2? |
1,6,2 | 1, 3, 5 |
Can you skip by 2 counting down? |
7,3,2 | 7, 5, 3 |
Can you count a single thing? |
1,1,100000 | 1 |
- A program decomposition, showing how the various modules will interact.
main
|
+--------------+-----------------+
| | |
open file get problem solve problem
- Algorithms for the main and all sub algorithms required to solve this problem.
Main
Open the file.
get a problem
while not at the end of the file
solve the problem
get a problem.
Open the file
Ask the user for a file name
try to open the file with that name.
while the file was not opened
Print error message
Ask the user for a file name
try to open the file with that name.
return the file stream
Get a problem
read the problem statement
read the start, stop and skip values
Solve the problem
if skip is not positive
print error
else if start is less than or equal to stop
lcv = start
while lcv is less than or equal to stop
if not the first time
print ", "
print lcv
increment lcv by skip
else
lcv = start
while lcv is greater than or equal to stop
if not the first time
print ", "
print lcv
decrement lcv by skip