Featured
- Get link
- X
- Other Apps
c++ program to convert lowercase to uppercase and vice versa
//Following Program accepts a String and then converts lowercase characters to uppercase and vice versa.
#include<iostream.h>
#include<stdio.h>
void main()
{
char str[100];
cout<<"\nEnter A String\n";
gets(str);
for(int i=0;str[i]!='\0';++i)
{
if(str[i]>=65&&str[i]<=90)
{
str[i]+=32;
}
else if(str[i]>=97&&str[i]<=122)
{
str[i]-=32;
}
}
cout<<"\nConverted String is : "<<str;
}
OUTPUT:
#include<iostream.h>
#include<stdio.h>
void main()
{
char str[100];
cout<<"\nEnter A String\n";
gets(str);
for(int i=0;str[i]!='\0';++i)
{
if(str[i]>=65&&str[i]<=90)
{
str[i]+=32;
}
else if(str[i]>=97&&str[i]<=122)
{
str[i]-=32;
}
}
cout<<"\nConverted String is : "<<str;
}
OUTPUT:
- Get link
- X
- Other Apps
Popular Posts
C++ program to display numbers which get reversed after multiplying by 4
- Get link
- X
- Other Apps
Comments
Post a Comment