Question: In C++. Create a function that reverses the lines in a file and outputs it into a new file. Reverse LINES of file, NOT STRINGS

In C++.

Create a function that reverses the lines in a file and outputs it into a new file. Reverse LINES of file, NOT STRINGS of file .

INPUT FILE EXAMPLE:

Hello there Foolish Greetings friend Bold one

OUTPUT FILE: (Reverse Lines)

Bold one Greetings friend Foolish Hello there

//Declare Function

void ReverseLines(ifstream &file);

//Example main function

int main()

{

ifstream file; string userFile;

cin >> userFile;

...

}

// Reverse lines function

void ReverseLines(ifstream &file) { ofstream outFile; outFile.open("Output.txt");

ANSWER HERE ]

Thank you

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!