Computers and Technology

Write a function that reads a text file, which has been opened in main program, and RETURNS the number of alphabetic characters (isalpha), digits (isdigit), punctuation characters (ispunct), and whitespace characters (isspace) in the file.
Here isalpha, isdigit, inpunct and isspace are C++ standard library functions, which are included in header file. More details about these functions are provided in Chapter 10.
Demonstrate the function in a complete program.
Hint
Use get function to read data from the file. For example, if fsIn is an opened input stream, then the following statement reads a character to the variable aChar from the opened file:
fsIn. get(aChar);
To read all data from a file, use while loop as follows:
while (fsIn. get(aChar)) // this is similar to while (fsin >> aChar)
{
……
}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:10, breanastone14
3. (5 points) describe what would be printed by the code below or what error would occur. const char* cstr = "0123456"; const char* ptr = & cstr[4]; cout < < ptr[-1] < < ptr < < endl; 1 4. (5 points) theseus has been trapped in a maze with a minotaur, which is trying to capture him. each round, theseus and the minotaur move through the maze; theseus towards the exit, and the minotaur towards theseus. theseus can move in any of the four cardinal directions, or he can wait for a round to see how the minotaur moves. write code that creates a data type to represent the possible moves that theseus could make.
Answers: 3
image
Computers and Technology, 22.06.2019 15:30, tfornwalt4390
Melissa needs to add a topic to an email that she will send to her teacher. choose the name of the field where she should type her topic.
Answers: 2
image
Computers and Technology, 22.06.2019 17:30, babyface1686
How do you make a lenny face? plz, brailiest to who can answer first.
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, jc624826
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
Do you know the correct answer?
Write a function that reads a text file, which has been opened in main program, and RETURNS the numb...

Questions in other subjects:

Konu
Biology, 18.10.2021 20:30