February 22, 2017

Homework Help: Programming

Posted by Don on Wednesday, June 29, 2011 at 5:55pm.

2. Then it should prompt the user for the input file name of the file containing the data to sort.
3. If the program can't open the file or if no file name is entered (^d or ^z is entered for EOF), it should print an error message and exit.
4. The file will contain numbers that could be positive or negative integers or floating point numbers two numbers to a line.
5. The program should only handle the first 90 numbers in the file.
6. The program should read the numbers from the file into an array and then sort in ascending order (low to high) them.
7. If the program encounters a non-numeric value in the file, it should print an error message indicating the line number of the line containing the error and discard that input line in the file and go to the next line.
8. The program should print the sorted list of numbers, four numbers to a line in columns fifteen characters wide with four digits to the right of the decimal point.
9. After printing the sorted list, it should print:
o There were <number> numbers found in file <file name>.
o The largest number found was: <number>
o The smallest number found was: <number>
o The average of the values is: <number>
10. If there are no numbers in the file, the program should only print the following line
o There were 0 numbers found in file <file name>.
11. Include comments in your code (see project two for the required comment block formats) to explain what the code does.
12. See the examples below for spacing and formatting.
13. Your program should be well structured. The work should be done in functions, not in main. Include at least four functions that you will define.
14. The program can not use global variables except for a debug variable.

Answer This Question

First Name:
School Subject:

Related Questions

More Related Questions