Chapter 4: Programming Project 2
Unlimited tries
(Convert an uppercase letter to lowercase)
Write a program that prompts the user to enter an uppercase letter and
converts it to a lowercase letter. For an incorrect input, display invalid input.
Sample Run 1
Enter an uppercase letter: T
The lowercase letter is t
Sample Run 2
Enter an uppercase letter: 5.
5 is an invalid input
For a hint on this program, please see
https://liangcpp.pearsoncmg.com/cpprevel2e.html.
If you get a logic or runtime error, please refer to
https://liangcpp.pearsoncmg.com/faq.html.
1 Enter your code

Respuesta :

The C++ program that prompts the user to enter an uppercase letter and converts it to a lowercase letter is:

#include <iostream>

using namespace std;

int main()

{

  char ch;

  cout<<"Enter a character in lowercase: ";

  cin>>ch;

  ch=ch-32;

  cout<<"Entered character in uppercase: "<<ch;

  return 0;

}

The above program is written in C++ program and it asks for input from the user in upper case and then converts it to lowercase letters.

If there is any input other than a letter, an upper case letter, an error would be given.

Some other variables that would be rejected are:

  • Numbers
  • Symbols
  • lower case letters

Read more about C++ programs here:

https://brainly.com/question/20339175

#SPJ1