Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem solving and debugging. Linux redirection to read data from a file. Use of conditional loop (while). Data File Descript ion A data file for

Problem solving and debugging.

Linux redirection to read data from a file.

Use of conditional loop (while).

Data File Description A data file for this exercise will consist of several lines of text that form sentences. The text may include letters, punctuation marks, and/or digits. Each sentence will be terminated with either a period (.), an exclamation mark (!), or a question mark (?). Design and implement a complete C++ program that will

using Linux redirection, read the contents of the file and

compute the average number of letters per sentence in the file

count the number of digits in the file

display the average with a label and 3 digits to the right of the decimal

display the digit count with a label

NOTES:

Make sure you choose enough test data to ensure that your program meets all the requirements.

If you use any library functions in your program make sure you include the appropriate header file(s).

Sample terminal session: [keys]$ more data4eight What is Earth Day? Earth Day is celebrated annually on April 22 to demonstrate support for environmental protection. It was first marked in 1970 and is coordinated globally by the Earth Day Network. More than 193 countries participate each year. [keys]$ g++ ex08.cpp [keys]$ ./a.out < data4eight Average # of letters per sentence is 48.250 Total # of digits in the file is 9 **EXTRA NOTES: -This does NOT use fstream. Input will be taken through cin. -String cannot be used. The program can be created without it.

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions