Hello, I'm very confused by my current assignment but have gotten quite a bit done. My question is probably simple so please accept my apologies in advance. I've read data in from a file, did some calculations and output to screen. There are two pieces of data I need from the math and while loop that have to go into 2-separate parallel arrays. This is where I get confused. How would I take the trip number and final cost and store them in the 2 arrays I created?
while(fileIn>>tripNbr>>fuelCost>>wasteDisp>>misCost) //while loop to read in data from file
{
fuelTotal = fuelCost - (fuelCost * .10);
double finalCost = fuelTotal + wasteDisp + misCost;
cout<<tripNbr<<setprecision(2)<<fixed<<setw(14)<<fuelCost<<setw(10)<<wasteDisp
<<setw(10)<<misCost<<setw(15)<<fuelTotal<<setw(15)<<finalCost<<endl;
//Write trip number to the nbrOfTrip[] array and finalCost to totalCost[] arrays.
/*then I'm supposed to increment the counter by 1...Not sure if this is correct
do I reinitialzie the counter like this
//int counter++;
//open output file
fileSave.open("TripCost.txt");
//write data to file in reverse order
for(counter = 0; counter < ARRAY_SIZE; counter--)
{
fileSave<<nbrOfTrip[counter]<<endl; //do these look correct??
fileSave<<totalCost[counter]<<endl;
}
*/