Answer to Question #244285 in Mechanical Engineering for zenni

Question #244285

Obtain input from a user. ( only 1 input ) and Determine the input as follows ( Letter A - Z, a - z ), Number ( 0 - 9 ), Special. Character )

If the input is a Letter ( determine if ( Vowel or Consonant )

Output the result.


1
Expert's answer
2021-10-12T01:54:14-0400

Check input character is an alphabet, digit, or special character using C++


/ CPP program to find type of input character

#include <iostream>

using namespace std;

void charCheck(char input_char)

{

    // CHECKING FOR ALPHABET

    if ((input_char >= 65 && input_char <= 90)

        || (input_char >= 97 && input_char <= 122))

        cout << " Alphabet ";

 

    // CHECKING FOR DIGITS

    else if (input_char >= 48 && input_char <= 57)

        cout << " Digit ";

 

    // OTHERWISE SPECIAL CHARACTER

    else

        cout << " Special Character ";

}

 

// Driver Code

int main()

{

    char input_char = '$';

    charCheck(input_char);

    return 0;

}



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS