Question: 3. Write a C++ program which reads each line in a file, reverses its lines, and writes them to another file. For example, if the

3. Write a C++ program which reads each line in a file, reverses its lines, and writes them to another file. For example, if the file input.txt contains the lines

Mary had a little lamb

Its fleece was white as snow

And everywhere that Mary went

The lamb was sure to go.

Then, the output, output.txt will contain:

The lamb was sure to go.

And everywhere that Mary went

Its fleece was white as snow

Mary had a little lamb

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!