Question: Program Write a program that: 1. Prompts the user for an output data filename. The last character of this prompt must be a new line

Program Write a program that: 1. Prompts the user for an outputProgram

Write a program that: 1. Prompts the user for an output data filename. The last character of this prompt must be a new line character (In). 2. Gets the filename from stdin. . 3. Opens the file for writing. 4. Receives a line containing the first value in the range from the stdin (DO NOT PROMPT FOR THIS INPUT). The line is terminated by a in. If this is a blank line, exit the main loop and terminate the program. 5. Receives a line containing the last value in the range from the stdin (DO NOT PROMPT FOR THIS INPUT). The line is terminated by a in. 6. Invokes a function called computeMaxSequenceLength 1. computeMaxSequenceLength does the following : 1. For each value of n in the range 1. Invokes a function called computeSequenceLength. computeSequenceLength does the following: 1. Calls computeNextValue to compute each value of the sequence, using the algorithm shown above. 2. Returns the length of the sequence. 2. Updates the max sequence length of the current range of n values. 7. Writes the first value in the range, the last value in the range, and the maximum sequence length for the range, separated by tabs (it), and ended with a newline character (In) to the output data file. 8. Prints "Completeln" to stdout. "" Non-Functional Requirements 1. Your project name must follow the pattern: {FLname}ThreeNPlusOne, where {FLname} is replaced by the first letter of your first name plus your last name. E.g. if your name is Maria Marciano, your project name mus 2. Your source code file must be named main.c. 3. main.c must be properly formatted (use Ctrl-Shift-f early and often). 4. The first executable line of your program must turn off output buffering. This is a requirement for automated testing. The following line will do the trick: setvbuf(stdout, NULL, LIONBF, 0); 5. Your program may have other functions, but at a minimum, it must have main computeMax SequenceLength(). computeSequenceLength, and computeNextValue(). 6. Every function, other than main, must have a function declaration as well as a definition. 7. Every function must be preceeded by a comment that describes what the function does in terms of its parameters and return value. Input All ranges will be on the range 1 to 9,999. Sample screen output (black) and keyboard input (blue): Enter the output filename: out.txt 1 10 900 1000 Sample Output File 1 900 10 1000 20 174 Write a program that: 1. Prompts the user for an output data filename. The last character of this prompt must be a new line character (In). 2. Gets the filename from stdin. . 3. Opens the file for writing. 4. Receives a line containing the first value in the range from the stdin (DO NOT PROMPT FOR THIS INPUT). The line is terminated by a in. If this is a blank line, exit the main loop and terminate the program. 5. Receives a line containing the last value in the range from the stdin (DO NOT PROMPT FOR THIS INPUT). The line is terminated by a in. 6. Invokes a function called computeMaxSequenceLength 1. computeMaxSequenceLength does the following : 1. For each value of n in the range 1. Invokes a function called computeSequenceLength. computeSequenceLength does the following: 1. Calls computeNextValue to compute each value of the sequence, using the algorithm shown above. 2. Returns the length of the sequence. 2. Updates the max sequence length of the current range of n values. 7. Writes the first value in the range, the last value in the range, and the maximum sequence length for the range, separated by tabs (it), and ended with a newline character (In) to the output data file. 8. Prints "Completeln" to stdout. "" Non-Functional Requirements 1. Your project name must follow the pattern: {FLname}ThreeNPlusOne, where {FLname} is replaced by the first letter of your first name plus your last name. E.g. if your name is Maria Marciano, your project name mus 2. Your source code file must be named main.c. 3. main.c must be properly formatted (use Ctrl-Shift-f early and often). 4. The first executable line of your program must turn off output buffering. This is a requirement for automated testing. The following line will do the trick: setvbuf(stdout, NULL, LIONBF, 0); 5. Your program may have other functions, but at a minimum, it must have main computeMax SequenceLength(). computeSequenceLength, and computeNextValue(). 6. Every function, other than main, must have a function declaration as well as a definition. 7. Every function must be preceeded by a comment that describes what the function does in terms of its parameters and return value. Input All ranges will be on the range 1 to 9,999. Sample screen output (black) and keyboard input (blue): Enter the output filename: out.txt 1 10 900 1000 Sample Output File 1 900 10 1000 20 174

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!