Explain initialize variables counting the lines and letters

Assignment Help C/C++ Programming
Reference no: EM13307756

C++, OOP

Write a program that reads a given text file, outputs the text file as is, and also prints the number of lines and the number of times each letter appears in the text file. (To simplify things, treat uppercase letters and lowercase letters as being the same.)

oCreate an array of 26 components to do the letter count for the 26 letters in the alphabet and a variable for the line count. (You may wish to call these variables letterCount and lineCount respectively.)

oHint: Use the plan of declaring variables, opening input and output files, initializing the variables, reading and writing the character for each character in a line, incrementing the letter count, incrementing the line count, outputting line and letter counts and, finally, closing the input and output files. (You may wish to call the program outputting line and letter counts writeTotal.)

oCreate an ASCII (or text) file that contains text that will be used as input to your program. Call this file textinput.

oHave the output stored in a file called textouput.

oCreate ifstream and ofstream objects called and respectively.

oInclude 4 functions for initializing, copying text, counting, and writing the results to a file, respectively.

Af?A??Initialize the initial array with 0's.

Af?A??Have the file copying text specifically be able to read a line and output that line. (You may wish to call this file copyText.)

Af?A??Whenever a nonblank character is found, it calls the function that does the counting, characterCount, to update the letter count.

(Do not count blank, tab, or end-of-line characters as part of the letter count.)

Af?A??Have the characterCount function convert the letter to uppercase, find the index of the array corresponding to this letter and, if the index is valid, increment appropriate count.

Af?A??Have the main program do the following:

Declare variables.

Open the input and output files.

If the input file does not exist, exit the program.

Open the output file.

If the output file cannot open, exit the program.

Initialize variables counting the lines and letters.

Read the first character.

Use while (not end of input file).

Process the next line using the function that reads a line and outputs the line copyText.

Increment the line count. (Increment the variable lineCount.)

Read the next character.

Output the line count and letter counts.

Use writeTotal.

Close files.

Reference no: EM13307756

Questions Cloud

What would programs have to do for each type of hardware : If an applications' requests for data did not go through the OS, what would programs have to do for each type of hardware?
Find maximum distance that these stars could be from earth : Two stars are 2.1 Ã- 1011 m apart and are equally distant from the earth. Find the maximum distance that these stars could be from the earth
What steady-state concentration of co will be observed : If a temperature inversion forms over the city at a height of 0.70 km, how long will it take the carbon monoxide concentration to reach 50 ppm if the wind velocity is zero If the wind velocity is 1 m/s,
Obtain the final speed of the ball : A baseball has a mass of 0.140 kg, and it is pitched towards home plate at a speed of 54.0 m/s. what is the final speed of the ball
Explain initialize variables counting the lines and letters : If the output file cannot open, exit the program. Initialize variables counting the lines and letters. Write a program that reads a given text file, outputs the text file as is, and also prints the number of lines and the number of times each lette..
Find frequency will you observe : A fire truck has a siren with that generates a sound with a frequency of 6686 Hz. what frequency will you observe
Organizations that contribute to the labor relations : Prominent organizations that contribute to the labor relations - aspect of the HR field, so your boss has budgeted funds for you to increase your own expertise.
Determine will h increase or decrease and by how much : an air space above a long tube is pressurized to 50 kPa vacuum. water (20 degrees C) from a reservoir fills the tube to a height h. If the pressure in the air space is changed to 25kPa vacuum, will h increase or decrease and by how much
Find the intensity of the sound at the time of observation : A sound pulse has a power of 948.5 watts. find the intensity of the sound at the time of observation

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd