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
(15 POINTS) When an error is made in HTML code, the browser does what?
Rzqust [24]
Look up "List of HTTP status codes" in Wikipedia. It's important to know the error and this list show what possibilities exist.
7 0
3 years ago
Select three advantages of cloud computing.
777dan777 [17]

Answer:

easily managed, large amount of storage capacity, great flexibility

Explanation:

5 0
3 years ago
Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicatin
lyudmila [28]

Answer:

Following is the program in C language :

#include <stdio.h> // header file

#define n 5 //  macro

int main() main function

{

   int a[n],k1; // variable and array declaration

   printf("Enter the element:\n");

   for(k1=0;k1<n;++k1) //iterating the loop

   {

       scanf("%d",&a[k1]);//Read the values by user

   }

   printf("Output in Reverse Order:\n");

   for(k1=n-1;k1>=0;--k1)//iterating the loop

   {

   printf(" %d ",a[k1]); //Display the values

   }

   return 0;

}

Output:

Enter the element:

4

3

45

67

89

Output in Reverse Order: 89 67 45 3 4

Explanation:

Following is the description of the program

  • Define a macro "n" with value 5 after the header file.
  • Declared an array "a" and defined the size of that array by macro i.e "n".
  • Read the value by the user by using scanf statement in the array "a"
  • Finally In the last for loop display the values of array "a" by space.

7 0
3 years ago
Combination lock uses three numbers beween 1 and 36 with repetition , how mant combinations are possiable
artcher [175]
There are 46656 possible combinations.

6 0
3 years ago
Often, a single source does not contain the data needed to draw a conclusion. It may be necessary to combine data from a variety
nlexa [21]

To measure the pollution of a particular river, one must take the sample of the river and take the sample of pure water, then draw the conclusion, it will tell the amount of pollution in the river water.

<h3>What is pollution?</h3>

Pollution is the mixing of unwanted or harmful things in any substance or compound.

Water pollution is the mixing of toxics and chemicals in water.

Thus, to measure the pollution of a particular river, one must take the sample of the river and take the sample of pure water, then draw the conclusion, it will tell the amount of pollution in the river water.

Learn more about pollution

brainly.com/question/23857736

#SPJ1

6 0
2 years ago
Other questions:
  • Find the cell address of first column and last row some one pls answer :'(​
    9·1 answer
  • Cryptolocker is an example of what type of malware?
    11·1 answer
  • What component of a computer system holds the operating system when the computer is not running
    6·2 answers
  • External hard disks use different technology than internal hard disks. ture or false
    6·1 answer
  • Wap to input any multi digits number and display the sum of odd digits and even digits​
    5·1 answer
  • Given a int variable named callsReceived and another int variable named operatorsOnCall write the necessary code to read values
    13·1 answer
  • Justice wrote a program and forgot to put the steps in the correct order. Which step does she need to review?
    5·2 answers
  • Krya needs help deciding which colors she should use on her web page. What can she use to help her decide.
    11·1 answer
  • Is anybody willing to gift me V bucks? Gamer tag: SpiffyPlop
    13·2 answers
  • When would it be appropriate to run MS Office or Adobe on the Windows OS server ?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!