-
Notifications
You must be signed in to change notification settings - Fork 0
/
ollie107_UpperToLowerCase-1.cpp
33 lines (32 loc) · 1.19 KB
/
ollie107_UpperToLowerCase-1.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
#include<iostream>
using namespace std;
// CONVERSION OF UPPERCASE LETTERS TO LOWERCASE LETTERS !!!
int main()
{
// 1. CONVERTING UPPERCASE LETTERS TO LOWERCASE LETTERS WITHOUT USING STRING FUNCTIONS.
char UpperCase , LowerCase;
int ascii;
cout<<"Enter an uppercase letter: ";
cin>>UpperCase;
if(UpperCase>='A' && UpperCase<='Z')
{
ascii = UpperCase; // EXAMPLE OF IMPLICIT(automatic) TYPECASTING
cout<<"The ASCII value of "<<UpperCase<<" is: "<<ascii<<endl;
int temp = ascii+32;
// LowerCase = char(temp); // EXAMPLE OF EXPLICIT TYPECASTING
// LowerCase = (char)temp; // EXAMPLE OF EXPLICIT TYPECASTING
LowerCase = temp; // EXAMPLE OF IMPLICIT(automatic) TYPECASTING
int shit = LowerCase; // EXAMPLE OF IMPLICIT(automatic) TYPECASTING
cout<<"The corresponding lowercase letter of "<<UpperCase<<" is: "<<LowerCase<<endl;
cout<<"The ASCII value of "<<LowerCase<<" is: "<<shit<<endl;
}
else if(UpperCase>='a' && UpperCase<='z')
{
cout<<"Already in LowerCase !!!"<<endl;
}
else
{
cout<<"Invalid Input !!!"<<endl;
}
return 0;
}