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
Explain why the program did not print "clap", and how to fix it.
lara [203]

Answer:

Because you're using "elif".

If I were to have this code:

if *blank*:

    *action 1*

elif *blank*:

    *action 2*

If and elif is basically saying "one or the other". Since 10 is >= 2, it prints out only whistle. Instead of elif, you were to replace them all with "if", it would print out:

whistle

snap

clap

6 0
2 years ago
Two electronics technicians are looking at the testing instrument in the figure above. Technician A says that this instrument is
aleksklad [387]
I am pretty sure the answer is A.
4 0
3 years ago
Create an Entity-Relationship Diagram with the following requirements.
melamori03 [73]

Answer:

idk

Explanation:

6 0
3 years ago
After selecting a cell in the data range, what are some ways to create a table? Check all that apply.
lana66690 [7]

Answer: the answer is B /E

3 0
3 years ago
Read 2 more answers
What language(s) must be used to display a bare-minimum web page?
Reil [10]

Answer: Hyper Text Markup Language (HTML)

Explanation:  

Computers use language to communicate, just like people do and the way that computers communicate with the internet is through a language that is called Hyper Text Markup Language/ HTML

Hyper Text is the process of linking objects to each other, so that when one object is clicked the linking object can be viewed. Hyper Text Markup Language was created by Tim burners in 1990


8 0
3 years ago
Read 2 more answers
Other questions:
  • _ includes websites that encourage interaction and connection among people, businesses, and organizations.
    5·1 answer
  • Write a Python function merge_dict that takes two dictionaries(d1, d2) as parameters, and returns a modified dictionary(d1) cons
    5·1 answer
  • Which action is LEAST important to maintaining a healthy credit score?
    8·2 answers
  • Which of the following STEM discoverers developed a new type of computer hardware?
    11·1 answer
  • How is a cell named in microsoft excel 2016
    10·1 answer
  • How much health did a supply drop balloon originally have??
    7·2 answers
  • Enter a formula using a database function to calculate the total value in the Cost column for expenses that meet the criteria in
    12·1 answer
  • Which scenario is invalid for execution by unit Tests? A. Executing test scenarios for negative test scenarios.B. Executing meth
    5·1 answer
  • Please choose odd one out please tell fast​
    12·1 answer
  • Risk taker positive or negative​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!