needed to process the Suppose that you have the following statements: ofstream o
ID: 3847178 • Letter: N
Question
needed to process the Suppose that you have the following statements: ofstream outfile; double distance = 375; double speed = 58; double travelTime; Write C++ statements to do the following: a. Open the file travel.dat using the variable outfile. b. Write the statement to format your output to two decimal places in fixed form. c. Write the values of the variables day, distance, and speed in the file travel.dat. d. Calculate and write the travelTime in the file travel.dat. d. which header files are information in (a) to (d)?Explanation / Answer
a)
out_stream.open("travel.dat");
b)
std::cout << std::setprecision(2);
c)
out_stream.seekp(0,std::ios::end);
out_stream<<" "<<Day<<", "<<distance<<", "<<speed;
d)
in_stream >> distance >> speed;\ read distance and speed from the travel.dat
TravelTime=distancespeed;
d)
#include "stdafx.h"
#include "math.h"
#include <Windows.h>
#include <iostream>
#include <fstream>
#include <string>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.