-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter1.cpp
More file actions
44 lines (42 loc) · 866 Bytes
/
Copy pathchapter1.cpp
File metadata and controls
44 lines (42 loc) · 866 Bytes
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
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main()
{
// taking input in any data type
string input;
cout << " Enter ASCII value or character : ";
// user input
cin >> input;
// char variable daclaration
char ch;
int ascii;
// input Detection
if (input.length() > 1 || isdigit(input[0]))
{
ascii = stoi(input);
ch = ascii;
}
else
{
ch = input[0];
ascii = ch;
}
// printing values
cout << " Character:" << ch << endl;
cout << " ASCII Value:" << ascii << endl;
// checking ascii values
if (ch >= 'A' || ch <= 'z')
{
cout << " UpperCase";
}
else if (ch >= 'a' || ch <= 'z')
{
cout << "LowerCase";
}
else
{
cout << " Not a alphabet";
}
return 0;
}