Monday, July 22, 2013

Program to input characters and change their case using " do-while loop "

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
char ch;
do
{
    cout<<"\n Enter a character (0 to stop) : ";
    cin>>ch;
    if(ch=='\n')
    {
        ch=getchar();
        cout<<end1;
    }
    else
    if(ch>=65 && ch<=90)
    ch=ch+32;
    else
    if(ch>=97 && ch<=122)
    ch=ch-32;
    putchar();
}while(ch!='0');
getch();
}

No comments:

Post a Comment