Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that reads several lines from a data file and prints each word o

ID: 3551827 • Letter: W

Question

Write a program that reads several lines from a data file and prints each word of the

file on a separate line of an output file followed by the number of letters in that word.

Also print a count of words in the file on the screen when done. Assume that words are

separated by one or more blanks.

Use at least two functions, one main and one function call (Hint is using a pass by reference function)

Thee following is your sample input data from your input file:

Write a program that reads several lines from a data file and prints each word of the

file on a separate line of an output file followed by the number of letters in that word.

Also print a count of words in the file on the screen when done. Assume that words are

separated by one or more blanks.

The total number of words is 59

Sample output in output file:

Write 5

a 1

program 7

Explanation / Answer

#include #include #include #include #include #define inFile "C:\Users\s\Desktop\FK\Ch8_3.txt" #define outFile "C:\Users\s\Desktop\FK\out.txt" using namespace std; void processData(ifstream&, ofstream&); using namespace std; int main() { ifstream ids; ofstream ods; ids.open(inFile); // I know this opens the files I am reading from and writing to. ods.open(outFile); if (ids.fail()){ cerr
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote