IN C++ 9.11 File I/O Exercise 4 File I/O In this exercise you are going to read
ID: 3906378 • Letter: I
Question
IN C++
9.11 File I/O Exercise 4 File I/O In this exercise you are going to read a file containing text. You need to reverse the words and save it as a new file: output.txt. Sample input file would contain: This is a text. Input is: string1.txt Your output in output.txt should contain: text. a is This Some hints . . . Read the input file and count number of words & close the file Create an array of strings having size -number of words Read the input file again (for second time) and store the words in the array of strings & close the fileExplanation / Answer
#include #include #include using namespace std; void write_in_reverse(ifstream &in, ofstream &out) { string str; if(in >> str) { write_in_reverse(in, out); outRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.