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
Which windows command always navigates the command-line interface back to the root directory?
Pie
The answer is "cd \".
5 0
3 years ago
What is an aptitude assessment that matches students with study programs at specific colleges and universities?
melisa1 [442]
I think the correct answer would be FOCUS2. It is a system that guides members in choosing college or a major. It provides a starting point for students who are not yet certain of what they want to take academically. Hope this helps.
5 0
3 years ago
Read 2 more answers
Quick question how the internet has impacted y’all life ? 5 sentences or more
Alexeev081 [22]

Answer:

I grew up in the early internet stages. when i was young we would always have to sit at school, meetup somewhere, in town, or use the home phone. But when the internet was invented we could talk to each other through our computers at home. Old computers were so bulky and slow, but that was the coolest thing around. Now i can sit at home with my 20'' moniter on my 5g wifi and talking to my friends like theres no tomorrow. The internet has changed so much in the last years. If you were gonna tell me that one day ill be sitting at home playing games online and working from home on a laptop i would have told you that you were crazy.

Explanation:

6 0
2 years ago
Read 2 more answers
In what way, if any, can your social media presence affect your chances of getting a job in social media?
Leno4ka [110]

Answer:

Your social media postings can help you secure a job too, not just it being effective in a bad way.

Explanation:

Your content can give hiring managers an overall idea of your personality, what you are passionate about, how you interact with people in group discussions and how previous colleagues feel about you through recommendations and so on. All of these give you an advantage in securing a job.

7 0
2 years ago
"Bullet Lists" can be which of the following?
MariettaO [177]

Answer:

letters and numbered

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • A laptop gets replaced if there's a hardware issue. Which stage of the hardware lifecycle does this scenario belong to?
    5·1 answer
  • An email address is made up of all of the following parts except
    13·2 answers
  • A local government uses Short Message Service (SMS) text messages to alert local residents when roads are closed. Which of the f
    13·1 answer
  • Create a class named Circle with fields named radius, diameter, and area. Include a constructor that sets the radius to 1 and ca
    7·1 answer
  • Each processor core on a multi core processor generally runs faster than a single core processor
    14·2 answers
  • What is the encryption cipher that was the precursor to des??
    5·1 answer
  • Which of the following is generally true about 401(k) and 403(b) retirement plans
    5·1 answer
  • In an array based implementationof a queue a possible solution to dealing with the full condition is to
    14·1 answer
  • One friend claims that a dual-core system runs at twice the speed as a single-core system; another friend disagrees by saying th
    13·1 answer
  • Select the correct answer.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!