I created the following program to calculate the average value of a list of numbers from a csv/txt file. The numbers below can be as numerous as necessary.
cout << "The last number in this range is: " <<num<< "\n";
cout<< "The sum of this range is: " <<(total-num)<<'\n';
cout<< "The number of items in this range is: "<<x-1<<'\n';
cout<< "The average of this range is: "<<aver<<'\n';
cout<< ""<<'\n';
infile.close();
getchar();
return 0;
}
However, I am having a problem in terms of specifying to the program what to calculate if there is irrelevant data in the csv file; e.g. suppose there is a heading above the list of numbers:
Or, let us suppose that there is more than one array of numbers and I only want to calculate the average for the second row down.
How do I specify what specifically I would like to calculate within the file? Please include a modified version of the above code in your answer. Thank you.