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
Get step-by-step solutions from verified subject matter experts
