Question

C++ How do I use ASC II in order to see if an alphabet is lowercase...

C++

How do I use ASC II in order to see if an alphabet is lowercase or uppercase?

Please show me how to do this.

Homework Answers

Answer #1
#include <iostream>

using namespace std;

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

    if (ch >= 'a' && ch <= 'z') {   // we can simply compare with 'a' and 'z' see if character is in the range of lowercase
        cout << ch << " is lowercase" << endl;
    } else if (ch >= 'A' && ch <= 'Z') {   // we can simply compare with 'A' and 'Z' see if character is in the range of uppercase
        cout << ch << " is uppercase" << endl;
    } else {
        cout << ch << " is neither lowercase not uppercase" << endl;
    }
    return 0;
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Consider permutations of the 26-character lowercase alphabet Σ={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}. In how many of these permutations do a,b,c...
Consider permutations of the 26-character lowercase alphabet Σ={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}. In how many of these permutations do a,b,c occur consecutively and in that order? In how many of these permutations does a appear before b and b appear before c?
Use C language fist one to check if is lowercase,and second one to conver it to...
Use C language fist one to check if is lowercase,and second one to conver it to uppercase. Use ASCII table. boolean islowcase(char n) void strupper(char c)
If you use a randomly chosen 4 character password (comprising of all the lowercase, uppercase letters...
If you use a randomly chosen 4 character password (comprising of all the lowercase, uppercase letters and digits 0 to 9), say “Xp9m” how many maximum guesses are required by a computer to guess this password? Compare the strength of this password with an 8 character password instead (say “Cm8Rz0pQ”) ? Show the simple math that is underlying the calculation. Do you agree with the statement “ An 8 letter password is around two times more secure than a 4...
3. a. For both (i) and (ii) below, use the first and second order conditions to...
3. a. For both (i) and (ii) below, use the first and second order conditions to find (and verify) the profit maximizing level of output and then find the level of profits associated with this quantity. This is a price taking firm in a perfectly competitive industry. b. For both (i) and (ii) below, find the minimum price at which each firm is willing to produce a positive level of output. Show all work. (i) P = $240, and C(q)...
Hi, I'm currently stuck with my homework. I need to know how to write this program...
Hi, I'm currently stuck with my homework. I need to know how to write this program in Python as below: Write function repeatPhrase(phrase, n), which prints the given phrase n times, alternating between lowercase and uppercase. For example, repeat('The sky is blue', 5) would print: the sky is blue THE SKY IS BLUE the sky is blue THE SKY IS BLUE the sky is blue Please help me, thank you very much!
When you write code, how do you know that you need to use value or reference?...
When you write code, how do you know that you need to use value or reference? Please show with an example. I know reference is two way communication but it is not clear to me. Thanks
I have to design an ordered list that tests to see if ions are in solution...
I have to design an ordered list that tests to see if ions are in solution or not. My ions are Ba+2, Pb+2, Zn+2 and my reagents are KI, Na2CO3, Na2SO4. I don't know how to order these properly on this chart. I think I start by adding KI and that shows me that a Ba+2 cation is present but I am really not sure. Can anyone help and or please explain the method behind the order of this chart?
Below statement is vague. Please elaborate in greater detail: I can see how some executives do...
Below statement is vague. Please elaborate in greater detail: I can see how some executives do take advantage of situations, but I also agree that some executives have worked very hard and have steered their careers well, in order to achieve the goal of being paid well. So for the ones that take complete advantage of the situation in order to fulfill their own greed, like the executives of Enron, they are completely in the wrong. But for those who...
ONLY NEED C) i and ii and D) i and ii ANSWERED PLEASE ZD&D holds a...
ONLY NEED C) i and ii and D) i and ii ANSWERED PLEASE ZD&D holds a patent on a unique medical device that is used for DNA mapping. Assume that ZD&D is a single-price profit-maximizing monopolist and is currently earning positive economic profits. (a) Draw a correctly labeled graph and show each of the following. (i) ZD&D’s profit-maximizing price and quantity, labeled as P* and Q*. (ii) The area representing ZD&D’s economic profits. (iii) The allocatively efficient level of output,...
A 0.1987 g sample of an unknown Ni(II) salt was put into solution and properly treated...
A 0.1987 g sample of an unknown Ni(II) salt was put into solution and properly treated to form the solid nickel(II) dimethylglyoxime complex (molar mass = 288.917 g mol-1). When the precipitate was rinsed, dried, and cooled, it was determined to have a mass of 0.1763 g. Calculate the mass of nickel in the precipitate and the percent (by mass) of nickel in the original (unknown) salt sample. Please. Please show me detail work so that I understand this problem.If...