Create a program that reads in a series of sales dollar amounts from a file, stores the
amounts in an array, processes the array, and outputs to a file and the console the
number of sales amounts, the lowest amount, the highest amount, and a complete list
of the amounts in order from lowest to highest. Sample output shown on the next page.

  1. The maximum number of amounts in the file is 20, but it could have less. The program
    must keep track of the number of amounts read in from the file, and stop at the
  2. Required functions: (1) opening the files and file failure conditions, (2) reading the input
    and storing the values, (3) sorting the array, (4) writing and displaying the output.
  3. Create an input file named “salesAmounts.txt” with the following values in the order
    that they appear below vertically in the file. Zero marks the end of the data set and is
    not one of the amounts. The file location must be the project folder.
    29.95 3.55 34.70 12.34 2.67 33.89 24.99 18.45 4.99 9.95 0.00
  4. Recommendation: Use bubble sort in your solution

Edited by Reverend Jim: Moved to programming forum

1 Month
Discussion Span
Last Post by rproffitt

Hi I am a student.

const int LOCATIONS = 20;
void readData(double a[], int size, double& data); 
double avgArray(const double a[], double data);
double sumArray(const double a[], double data);
double findHigh(const double a[]);

Edited by Dani: Fixed your formatting for you


@K, Same as your other post. Very odd incompete response without telling where you are stuck.

I have to ask the following. Are you asking forums to write this code for you?


Yes,It would be great if forum could help me with the whole code.I appreciate it


As the student you write the entire program. As in most forums, members will help you understand why some code isn't working.

In short, write the code. If we write the code, you would not be learning how to write code which is what the class is all about.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.