inputs a string from the user and coverts all the capital letters to small letters and all the small letters to capital letters.
Example:
If the user enters string “HeLLo wOrLd”, the program will display it as “hElllO WoRlD”
i have written following code.. please tell where im wrong..as it is only converting small letters to capital letters..and not converting capital letters to small...
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
clrscr();
int count=0;
char a[1000];
int s,i;
cin.getline(a,1000);
for (s=0;a[s]!='\0';s++)
{count++;}
for (i=0;i<count;i++)
{
if ((a[i]>=65) && (a[i]<=90))
{a[i]=a[i]+32;}
if ((a[i]>=97) && (a[i]<=122))
{a[i]=a[i]-32;}
}
puts(a);
getch();
}