Write a program to convert all characters from lowercase to uppercase and all upper case characters to lowercase in given string
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int m,t=0,i;
char a[100];
cout<<"Enter the string\n";
cin.getline(a,100);
for(i=0;a[i]!='\0';i++) //to count total number of words include space
{
t++;
}
cout<<"\nString after conversion\n";
for(i=0;i<t;i++)
{
m=0;
m=a[i];
if(m>=65&&m<=90)
{
m=m+32;
cout<<char(m);
}
else
if(m>=97&&m<=122)
{
m=m-32;
cout<<char(m);
}
else
{
cout<<char(m);
}
}
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int m,t=0,i;
char a[100];
cout<<"Enter the string\n";
cin.getline(a,100);
for(i=0;a[i]!='\0';i++) //to count total number of words include space
{
t++;
}
cout<<"\nString after conversion\n";
for(i=0;i<t;i++)
{
m=0;
m=a[i];
if(m>=65&&m<=90)
{
m=m+32;
cout<<char(m);
}
else
if(m>=97&&m<=122)
{
m=m-32;
cout<<char(m);
}
else
{
cout<<char(m);
}
}
getch();
}
==OUTPUT==