-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcctype.cpp
47 lines (44 loc) · 1.12 KB
/
cctype.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <cctype>
using namespace std;
// cctype library contains functions that work with character data
int main()
{
char letter;
bool lower, upper, alpha, digit, blank ;
cout << "Enter a letter: ";
cin >> letter;
cin.get();
/*lower = islower(letter);
upper = isupper(letter);
alpha = isalpha(letter);
digit = isdigit(letter);
*/
//blank = isblank(letter);
if (islower(letter))
{
cout << "you entered a lowercase "<< letter << endl;
letter = toupper(letter);
cout << "I converted it to: " << letter << endl;
}
if (isupper(letter))
{
cout << "you entered a uppercase "<< letter << endl;
letter = tolower(letter);
cout << "I converted it to: " << letter << endl;
}
if (isalpha(letter))
cout << "you entered a alphabetic "<< letter << endl;
else
cout << "you did NOT enter a alphabetic "<< letter << endl;
if (isdigit(letter))
cout << "you entered a digit "<< letter << endl;
else
cout << "you did NOT enter a digit "<< letter << endl;
/*if (blank)
cout << "you entered a blank "<< letter << endl;
else
cout << "you did NOT enter a blank "<< letter << endl;
*/
cin.get();
}