Question: Create a text file called inmpg.txt in your project. It should contain four gallon amounts and the starting and ending miles on your odometer. This

 Create a text file called "inmpg.txt" in your project. It shouldcontain four gallon amounts and the starting and ending miles on your

Create a text file called "inmpg.txt" in your project. It should contain four gallon amounts and the starting and ending miles on your odometer. This file should contain no text, only numeric values separated by blanks EXAMPLE 11.7 14.3 12.2 8.5 67308.0 68750.5 22.5 15 19.6 10 95300 95670 100 90 20 35.5 7000 7500 Compile and run the following program. Note that the output generated by this program will be written out to a text file called outmpg.tr. "The file will be created automatically by your program. #include #include // For file I/O using namespace std; int main() // # of gallons for fillup 1 // # of gallons for fillup 2 // # of gallons for fillup 3 // # of gallons for fillup 4 float amt float amt2 float amt3; float amt4; float startMiles; II Starting mileage float endMiles; // Ending mileage float mpg ifstream inMPG ofstream outMPG; I/ Holds miles per gall. Output I/ Computed miles per gallon // Holds gallon amts &mileages // Open the files inMPG.open("inmpg.txt"); if (inMPG.fail() cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!