1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Aleksandr-060686 [28]
2 years ago
10

Write a program that reads the contents of a file named text.txt and determines the following: The number of uppercase letters i

n the file The number of lowercase letters in the file The number of digits in the file Prompts And Output Labels. There are no prompts-- nothing is read from standard in, just from the file text.txt. Each of the numbers calculated is displayed on a separate line on standard output , preceded by the following prompts (respectively): "Uppercase characters : ", "Lowercase characters : ", "Digits: ". Input Validation. None.
Computers and Technology
1 answer:
murzikaleks [220]2 years ago
3 0

Answer:

Explanation:

//Cpp program to count Uppercase, Lowercase, Digits count from file

#include<iostream>

#include<fstream>

using namespace std;

int main()

{

  //ifstream For reading file purpose only

ifstream file("text.txt");

 

  //cheks whether given file is present or not

  if(!file){

      cout<<"File not Found";

      return 0;

  }

  //variables for all three counts and character in file

char character;

int uppercaseCount=0, lowercaseCount=0, digitsCount=0;

  //loop for reading and checkile file character by character

while(file){

      //get a single character

file.get(character);

 

      //checks uppercase character

if((character >= 'A') && (character <= 'Z'))

uppercaseCount++;

     

      //checks lowercase character

 else if((character >= 'a') && (character <= 'z'))

lowercaseCount++;

     //checks lowercase character

      else if((character >= '0') && (character <= '9'))

      digitsCount++;

}

cout<<"\nUppercase characters: "<<uppercaseCount;

cout<<"\nLowercase characters: "<<lowercaseCount;

cout<<"\nDigits: "<<digitsCount;

return 0;

}

/*

content of File text.txt

C++

10.15: Character Analysis Write a program that reads the contents of a file named text.txt and determines the following: The number of uppercase letters in the file The number of lowercase letters in the file The number of digits in the file Prompts And Output Labels. There are no prompts-- nothing is read from standard in, just from the file text.txt. Each of the numbers calculated is displayed on a separate line on standard output, preceded by the following prompts (respectively): "Uppercase characters: ", "Lowercase characters: ", "Digits: ". Input Validation. None.

Output :-

Uppercase characters: 19

Lowercase characters: 434

Digits: 4

*/

You might be interested in
WHO LOVES THE KREW LOOK IT UP ON YOU_TUBE IF UR NOT SURE BUT PLZ SUBSCRIBE TO HER SHE DA BEST "YOOT" the one with pink and golde
kodGreya [7K]

Answer:

i like her mate :3 glad im not alone!

Explanation:

7 0
2 years ago
Read 3 more answers
A byte in memory is identified by a unique number called its
Murrr4er [49]
It is identified by its address number.
4 0
3 years ago
Q10: You cannot rename a compressed folder.
user100 [1]
<h2>Answer:</h2><h2>Oh yes you can. </h2>

Click slowly twice the folder.

Right click and choose rename.

4 0
2 years ago
Which of the following was the most significant impact the NEA had on the performing arts industry? W
Sedaia [141]

Answer:

The NEA’s focus on building new performing arts centers led to an increased production of arts.

5 0
2 years ago
What three components should be included in a computer that is used to create TV commercials and music videos? (Choose three.
Vikki [24]

The three components is a specialized video card, large and fast hard drives and specialized audio card.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Does the sticker list an automatic or manual transmission?
    8·2 answers
  • _________ are represented using diamonds linked withparticipant ETs
    6·1 answer
  • Write a program that uses for loops to perform the following steps: Prompt the user to input two integers: firstNum and secondNu
    15·1 answer
  • You’re browsing the internet and realize your browser is not responding. Which of the following will allow you to immediately ex
    11·1 answer
  • As part of the systems engineering development team, use IDEF0 to develop a functional architecture. The functional architecture
    13·1 answer
  • Your windows system is used by several people, so you want increase security by requiring users to create passwords that are at
    9·1 answer
  • What is output?
    10·1 answer
  • We can improve our knowledge and skills on animals and fish raising with the use of internet​
    15·1 answer
  • if a hacker wants to exploit the TCP three-way handshake, what is the most effective way to go about it?
    15·1 answer
  • Question 1 (True/False Worth 3 points)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!