5. (5 points) Suppose that you have the following statements: ofstream outfile d
ID: 3877302 • Letter: 5
Question
5. (5 points) Suppose that you have the following statements: ofstream outfile double distance 375 double speed-58: double travelTime Write C++ statements to do the following: Open the file travel.dat using the variable outfile. Write the statement to format your output to two decimal places in fixed form Write the values of the variables day, distance, and speed in the file travel.dat Calculate and write the travelTime in the file trave1.dat. Which header files are needed to process the information in (a) to (d)? a. b. c. d. e.Explanation / Answer
Dear Student,
below are the answer..
===============================================================
Ans: a
outfile.open("travel.dat");
===============================================================
Ans:b
cout<<fixed<<setprecision(2)<<endl;
===============================================================
Ans:C
outfile<<day<<endl;
outfile<<distance<<endl;
outfile<<speed<<endl;
================================================================
Ans:D
travelTime = distance/speed;
outfile<<travelTime<<endl;
================================================================
Ans:e We need fstream, iostream, iomanip, header files to process the information from (a) to (d).
===============================================================
Kindly Check and Verify Thanks...!!!
================================================================
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.