Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please type the proper code** // PreLab 2 Assignment // Write a program that copies the data in the // prelab input file to an

Please type the proper code**

// PreLab 2 Assignment

// Write a program that copies the data in the

// prelab input file to an output file "flux_capacitor"

// so that it is formatted the same in both files.

// Additionally add 30 to the year when you rewrite

// it to the output file to help Marty Mcfly get back to

// his proper time.

#include

#include

using namespace std;

int main() {

// ADD HERE declare variables

// declare input file stream variable and open file

ifstream fin;

fin.open("prelab_input.txt");

// Test to see if file correctly opened. If statements will

// be learned in the future. For now, don't worry about

// understanding this.

if (!fin) {

cout << "ERROR - File failed to open. make sure that " << "the input file and this file are in the"

<< "same directory" << endl;

return -1;

// Return statement will terminate the program. We do not want

// to continue if we do not have a valid input file.

}

// declare output file stream varaible and open file

ofstream fout;

fout.open("flux_capacitor.txt");

// ADD HERE write your code here

// closing files

fin.close();

fout.close();

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions