The following code is for a C++ Programme to change the case of a given alphabet.
That is :
If "a" is input , the output is "A" [ Small letter to Capital letter]
If "A" is input , the output is "a" [ Capital letter to Small letter]
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
char a,c;
int b,d;
cout<<"Enter a alphabet\n";
cin>>a;
b=a;
if(b<91)
{
d=b+32;
c=d;
cout<<c;
}
else
{
d=b-32;
c=d;
cout<<c;
}
getch();
}
That is :
If "a" is input , the output is "A" [ Small letter to Capital letter]
If "A" is input , the output is "a" [ Capital letter to Small letter]
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
char a,c;
int b,d;
cout<<"Enter a alphabet\n";
cin>>a;
b=a;
if(b<91)
{
d=b+32;
c=d;
cout<<c;
}
else
{
d=b-32;
c=d;
cout<<c;
}
getch();
}
0 comments:
Post a Comment