Write a function that converts an uppercase letter to lowercase. Use the following function header:

char toLowerCase(char ch)
If the character is not an uppercase letter, the method simply returns the character itself. For example, toLowerCase('B') returns b and toLowerCase('5') returns 5. See Exercise 2.7 on how to convert an uppercase letter to lowercase. Write a test program that prompts the user to enter a character, invokes the function, and displays its return value.
```

Enter a char: A
a


Enter a char: 3
3

```


```
#include
using namespace std;

char upperCaseToLowerCase(char c)
{
if (c >= 'A' && c <= 'Z')
{
return (char)(c + ('a' - 'A'));
}

return c;
}

int main()
{
cout << "Enter a character: ";
char ch;
cin >> ch;
cout << upperCaseToLowerCase(ch) << endl;

return 0;
}
```

Computer Science & Information Technology

You might also like to view...

You cannot assign a double or a decimal value to an int variable because such an assignment could result in ____________.

a. buffer overflow b. a run time error c. a loss of data d. value sharing conflicts

Computer Science & Information Technology

A layout that does not appear on the screen as planned is called a ____.

A. failed layout B. broken layout C. column drop D. fluid layout

Computer Science & Information Technology

The top-level element in a Path's directory structure is located at index 1.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

What three features must an Internet application have to be secure?

What will be an ideal response?

Computer Science & Information Technology