Asked Oct 22, 2019

An uppercase character is a character whose ASCII value is between 65(A) and 90(Z).

Write a C++ program that prompts the user to enter a string from the keyboard and will count the number of uppercase characters and replace each uppercase character by the correspoding lowercase character


Expert Answer

Step 1

Following is the c++ program:

For loop is used to from 0 to length of string to read every character of string. If the ASCII value of a character is found to be upper case(in range 65 to 90) then add 32 to convert that upper-case character to lower-case. Counter c is used which counts the number of upper-case characters.

Step 2

#include <iostream>//header file for input output


using namespace std;

int main() {

  string str; //declaring string

  int c = 0; //variable to store no of upper case character

  //promt user to enter a string

  cout << "Enter the String : ";

  //store string

  getline(cin, str);

  /* using for loop from 0 to length of string

   * and to convert upper case character into lower case

   * add 32 to ASCII value of uppercase character */

  //' represent end of string

  for (int i = 0; str[i] != ''; i++) {

    /*check if character is in upper c...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in


Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A

Q: What is the difference between hardware interrupts and software interrupts and give examples of situ...

A: Hardware interrupts:The physical signals either from within the microcontroller itself or may be fro...


Q: Write a query to display the book number, title, and cost for all books in the “Database” subject so...

A: The name of the table is the subject.Attributes of the table are book_number, book_title, book_costC...


Q: In a server, the processor accounts for 50% of total server power, the memory system accounts for 30...

A: For a server,Power consumption of processor = 50 % of total powerPower consumption of memory system ...


Q: If you are driving across the border into Canada, it is difficult with the road signs in KPHvalues. ...

A: Algorithm-STARTStep1: Import the essential headers.Step2: Define a class Conversion.Step3: Define th...


Q: PLEASE EXPLAIN ALL STEPS: This question has been answered multiple times, clearly by the same tutor,...

A: 1)xz + (xy + ~z)As there are three variables in the above Boolean expression there will be 23 = 8 ca...


Q: What role does database technology play in managing data as a business resource within an organizati...

A: Data resource management is applying software tools and information systems technologies such as dat...


Q: Problem 1 consists of multiple parts. You should finish one part and ensure that it works before mov...

A: Hello. Since your question has multiple sub-parts, we will solve first three sub-parts for you. If y...


Q: Is the file structure of Windows 10 File Explorer or hierarchy?

A: File structure of an operating system cannot be differentiated as file explorer or hierarchy.


Q: what is a router?

A: Router:A router is a physical or virtual tool for receiving, processing and transferring incoming pa...