. " while " .
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 and final cost to the 2 parallel arrays...not sure how to
//to do this.
}
. , , .
-, . , , . "numberOfTrips".
int numberOfTrips = 0;
while(fileIn>>tripNbr>>fuelCost>>wasteDisp>>misCost)
{
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;
nbrOfTrip[numberOfTrips] = tripNbr;
totalCost[numberOfTrips] = finalCost;
++numberOfTrips;
}
, , , , . , 'numberOfTrips' .
for(counter = 0; counter < numberOfTrips; counter++)
{
fileSave<< nbrOfTrip[counter]<<endl;
fileSave<< totalCost[counter]<<endl;
}