I am to take data from a file, then calculate average rainfall and output the data to another file.
A sample of the input file would be this
Location A 500 30 35 40 45 50
Location B 600 35 40 45 50 55
Location C 700 40 45 50 55 60
Where 'Location A' would be the name of the site, '500' would be the elevation, and '30 35 40 45 50' is the rainfall each month. I know i need to use getline(inputFile, location, \t) to get the names of the sites, however i do not know where to place it in my code.
Here is the start of my loops where i suspect i should put it.
1 2 3 4
|
while (inFile >> location >> elevation >> precipAmount)
{
for (count; count <= 12; count ++)
|
Any help would be appreciated as ive been writing this program for the better part of three hours trying to get it right.