Question: C++ Programming Write a function named wordStats that accepts an input stream and an output stream as parameters. The input stream represents an input file

C++ Programming

C++ Programming Write a function named wordStats that accepts an input stream

Write a function named wordStats that accepts an input stream and an output stream as parameters. The input stream represents an input file holding a sequence of words. Your function reports the total number of words (as an integer) and the average word length (as an un-rounded real number). You may assume that the input stream isn't empty. For example, suppose the input stream is reading an input source that contains the following words: To be or not to be, that is the question For the purposes of this problem, we will use whitespace to separate words. That means that some words include punctuation, as in "be, ". (This is the same definition that the input stream uses for tokens.) For the input above, your function should produce exactly the following output: Total words = 10 Average length 3.2

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!