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]
3 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]3 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
A laptop gets replaced if there's a hardware issue. Which stage of the hardware lifecycle does this scenario belong to?
Ilya [14]

Answer: Maintenance. This is the stage where software is updated and hardware issues are fixed if and when they occur. Retirement. In this final stage, hardware becomes unusable or no longer needed and it needs to be properly removed from the fleet

Explanation:

3 0
3 years ago
If a file is opened for reading and the file does not exist,what action is taken?
worty [1.4K]

Answer:

C)An error message is issued.

Explanation:

If we try to open a file for reading when that file does not exist, we will get an error message.

For example, in Java we will encounter a FileNotFoundException as in the code below:

       try {

           FileInputStream fis = new FileInputStream("myFile.txt");

           DataInputStream dis = new DataInputStream(fis);

           BufferedReader br = new BufferedReader(new InputStreamReader(dis));

           String str = null;

           while ((str = br.readLine()) != null) {

               System.err.println(str);

           }

       } catch (FileNotFoundException e) {

           e.printStackTrace();

       }

If the file myFile.txt does not exist we can expect to see an exception stack trace corresponding to FileNotFoundException.

8 0
4 years ago
Write a few statements that open a file called "greeting", write the message "hey!" to the file -- and then close it. declare an
pshichka [43]
C++:

int main () {

std::ofstream output {"greeting.txt"};
output << "hey!";
output.close();

return 0;
}
6 0
3 years ago
Read 2 more answers
.To remove data from a table we use the DELETE verb? (true/false)
Andrew [12]

Answer:

The correct answer for the given question is "true".

Explanation:

Yes delete is a verb in a database table  because it perform the action it means it will delete the data or record from a database table .The SQL query of delete is

Delete from tablename ;

For example :delete name from student;

In this query name will deleted from student table this action will be performed by delete query so we conclude that delete is a verb.

5 0
4 years ago
dns is a network of decentralized servers that translate urls (uniform resource locators) into ip address. true false
Rina8888 [55]

Dns is a network of decentralized servers that translate urls (uniform resource locators) into ip address ---- True

<h3>DNS Stands for :</h3>

DNS, or Domain Name System, translates human-readable domain names (such as www.amazon.com) into machine-readable IP addresses.

<h3>What is the IP address of your DNS server?</h3>

The Domain Name System (DNS) is the name database where Internet domain names are found and translated into IP (Internet Protocol) addresses. The Domain Name System maps the name that users use to look up her website to the IP address that computers use to look up that her website.

<h3>Is DNS the same as IP address?</h3>

Web browsers use Internet Protocol (IP) addresses to interact. DNS translates domain names into IP addresses and allows browsers to load Internet resources. Every device connected to the Internet has a unique IP address that other computers use to find the device.

Learn more about DNS :

brainly.com/question/17952402

#SPJ4

4 0
1 year ago
Other questions:
  • Let's assume that the smallest possible message is 64 bytes (including the 33-byte overhead). if we use 100base-t, how long (in
    10·1 answer
  • Why is it important to save a print copy of electronic sources?
    6·1 answer
  • Write a program that prompts the user to enter a three digit integer and determine whether it is a palindrome number.
    12·1 answer
  • In cell E12, enter a formula to calculate the % of Budget by dividing the Actual expense by the Budget expense to indicate the p
    9·1 answer
  • True / False<br> General purpose registers can be read and written by ML programs
    10·1 answer
  • 4. You are planning to buy a new couch for your family room. Before you leave for the furniture store, you measure the available
    11·1 answer
  • Fix the two words that are used incorrectly.
    10·2 answers
  • Win10如何删除自己添加的环境变量?...............
    8·1 answer
  • PLEASE ANSWER AND HURRY I'LL MARK YOU BRAINLIEST!!<br><br><br>​
    9·1 answer
  • How do i copy a canvas course from old class to new course.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!