Hi! This is my very first post on the forum so please excuse me if there's anything I've done inproperly.
I have assignment where I need to write a program that reads sales data from a text file, sorts the data and outputs the sorted data to a second file. The input file is a comma-seperated value file (CSV), with the first item being the number of sales data items to be processed, followed by the list of sales data on one line (items are seperated by commas). Each sales data item is decimal number.
I should be able to sort and write data into the output file but i'm encountering problem writing the following function required by professor:
a function (getSalesData) to read the sales data form the input file and store it in an array of the appropriate size. Since the number of data items will vary from one program execution to another, you want to use a dynamic array to store the sales data. In function main() open the input file, read the number of sales data items, create a dynamic array of the proper size then call function getSalesData with the name of the array, its size, and the input file stream variable as paramters. Function getSalesData when called, reads the sales data items from the input stream parameter into the array. Remember that array are always passed by reference.
Please help me if you know how to do this. Much appreciated!!!