: price purchase and traveled are doubles pulled in from a file where they are
: space deliniated
: i.e.
: .999 13.5 285.6
: 1.019 14 275
: 1.159 16.75 299.4
: the following is the code that will handle the printout that I am having
: trouble with.
:
: cout.setf(ios::fixed,ios::fixed); //setting the fixed float fields
: cout.setf(ios::left,ios::adjustfield); //setting the fixed float fields
: do
: {
: if (fin>>price)
: {
: fin>>purchase>>traveled;
: cout<<"
"<<setw(22)<<"Gas Price Per Gallon"<<"=<br>
: $"<<setprecision(3)<<price<<endl; //THIS IS THE LINE I NEED HELP WITH<br>
: cout<<setw(22)<<"Total Purchase Amount"<<"=<br>
: $"<<setprecision(2)<<purchase<<endl;<br>
: cout<<setw(22)<<"Total Miles Travelled"<<"=<br>
: "<<setprecision(1)<<traveled<<endl;<br>
: cout<<setw(22)<<"Miles Per Gallon"<<"=<br>
: "<<setprecision(0)<<mpg(traveled,price,purchase)<<endl;<br>
: }
: while( );
It looks like you're new here. If you want to get involved, click one of these buttons!