Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program to create a text file. Your file should contain the following text: Batch files are text files created by programmer. The

Write a C++ program to create a text file. Your file should contain the following text:

Batch files are text files created by programmer.

The file is written in notepad.

Creating a text file and writing to it by using fstream: to write to a file, you need to open thew file as write mode. To do so, include a header filr to your program. Create an object of type fsrteam. Open the file as write mode.

Reading from a text file using fstream object: Besides including the fsrteam header file to your program, there are three points to remember to read from a batch file. First, to make sure there exists a file. Second, make sure the existing file is not emty. Third, open the file as a read mode.

To append text to the existing file: open and existing file as append mode which will append new information at the end of the file if the file is not emty.

Binary files: binary files are readable only by the compiler. A user would not be able to read a binary file.

Your program should read the text file and create the following output:

1. Find the number of words in each line and display it.

2. Find the number of lines and display it.

3. Find the total number of words in the file and display it.

4. Find the number of words that start with capital letters on each line and display it.

5. Find how many time word "file/files" are represented and display 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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

Explain the concept of equal employment opportunity.

Answered: 1 week ago

Question

Explain the various job analysis methods.

Answered: 1 week ago

Question

Describe the components of a job description.

Answered: 1 week ago