Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USING C++ Given the following program readline.cpp and the data file input.txt: // Program readline.cpp demonstrates how to read a line of text from a

USING C++

Given the following program readline.cpp and the data file input.txt:

// Program readline.cpp demonstrates how to read a line of text from a file #include #include #include using namespace std; int main() { string str1, str2, str3, str4; // declares 4 variables ifstream inData; // declares input stream ofstream outData; // declares output stream inData.open("input.txt"); // binds program variable inData to the input file "input.txt" outData.open("output.txt"); // binds program variable outData to the output file "output.txt" // input 4 lines getline(inData,str1); getline(inData,str2); getline(inData,str3); getline(inData,str4); // output 4 lines outData << str4 << endl; outData << str3 << endl; outData << str2 << endl; outData << str1 << endl; // outputs 4 lines inData.close(); outData.close(); return 0; } 

The input data file input.txt.

Allan Smith John Cooper Zhang Hua Yao Ming 

You are required to deliver the following:

Edit/create the input data file input.txt and the program file readline.cpp.

Compile and run the program readline.cpp.

Check the content of the output data file by cat output.txt in hercules or notepad for Visual Studio users.

Modify the program readline.cpp to work with your new input data file.

Compile and run this C++ program.

Run the program for your lab instructor and show the result in output.txt.

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

EXPLAIN under what conditions it is best to use an incentive plan.

Answered: 1 week ago

Question

=+When and under what circumstances are contracts renegotiated?

Answered: 1 week ago

Question

=+Are the contracts enforceable?

Answered: 1 week ago