Write a program that will ask the user to enter a character check if it is alphabetic or not. If alphabetic, check whether it is in uppercase or lowercase.
Answers
Answered by
3
Explanation:
- Declare a char to input a character.
- Create a nested if-else to check inserted character is alphabet or not.
Program:
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char c;
cout << "Enter a character" << endl;
cin >> c;
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
{
cout << "It's an Alphabet." << endl;
if(c >= 'a' && c <= 'z')
cout << "Lowercase alphabet.";
else
cout << "Uppercase alphabet.";
}
else
cout << "Not an alphabet.";
return 0;
}
#answerwithquality
#BAL
Attachments:
Similar questions
English,
5 months ago
India Languages,
5 months ago
English,
5 months ago
Social Sciences,
10 months ago
Economy,
10 months ago