double* read_data(int& size); This function reads data from cin until the user t
ID: 3684534 • Letter: D
Question
double* read_data(int& size);
This function reads data from cin until the user terminates input by entering Q. The function should set the size reference parameter to the number of valid scores from user input. Return a pointer to an array on the heap. That array should have exactly size elements. Of course, you won’t know at the outset how many scores the user will enter. Start with an array of CAPACITY elements, and double the size whenever the array fills up. Be sure to delete any intermediate arrays.
You can assume that the input file contains student last name and first name, separated by a comma, followed by a Tab key, then the midterm score of the student on each line.
You can assume good data in the files (correct format for each line).
C ++ please help
Explanation / Answer
double* read_data(int& size); int _tmain(int argc, _TCHAR* argv[]) { int size = 0; double* resultone = read_data(size); /* to store the final result */ double* endhere = new int[size]; for(int i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.