Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function inputStats that takes an istream& and an ostream& as parameters. The input stream represents an input file. Your function reports various statistics

Write a function inputStats that takes an istream& and an ostream& as parameters. The input stream represents an input file. Your function reports various statistics about the file's text. In particular, your function should report the number of lines in the file, the longest line, the number of tokens on each line, and the length of the longest token on each line. You may assume that the input file has at least one line of input and that each line has at least one token. For example, if an input stream named input opened with the file carroll.txt which contains the following text:

"Beware the Jabberwock, my son,

the jaws that bite, the claws that catch,

Beware the JubJub bird and shun

the frumious bandersnatch."

The call to inputStats(input, cout); should produce the following output: Line 1

Line 1 has 5 tokens (longest = 11)

Line 2 has 8 tokens (longest = 6)

Line 3 has 6 tokens (longest = 6)

Line 4 has 3 tokens (longest = 14)

Longest line: the jaws that bite, the claws that catch,

its c++. not java.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago