123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
Prg. to convert upper case to lower case or lower case to upper case depending on the name it is inv

--------------------------------------------------------------------------------



#include <stdio.h>
#include <conio.h>

void lower_to_upper();
void upper_to_lower();
void main()
{
int n;
clrscr();
printf("
Please enter your choice.");
printf("
(1) for upper to lower conversion.");
printf("
(2) for lower to upper conversion.");
printf("
CHOICE:- ");
scanf("%d",&n);
switch (n)
{
case 1:
{
printf("Please enter a string in upper case.");
printf("
String will be terminated if you press Ctrl-Z.");
printf("
STRING:- ");
upper_to_lower();
break;
}

case 2:
{
printf("Please enter a string in lower case.");
printf("
String will be terminated if you press Ctrl-Z.");
printf("
STRING:- ");
lower_to_upper();
break;
}
default:
printf("ERROR");
}
printf("




HAVE A NICE DAY! BYE.");
getch();
}
void upper_to_lower()
{
int i,j;
char c4[80],c3;
for (i=0;(c3=getchar())!=EOF;i++)
c4[i]=(c3>='A' && c3<='Z')?('a' + c3 -'A'):c3;
printf("
The lower case equivalent is ");
for (j=0;j<i;j++)
putchar(c4[j]);
return;
}

void lower_to_upper()
{
int i,j;
char c2[80],c1;
for (i=0;(c1=getchar())!=EOF;i++)
c2[i]=(c1>='a' && c1<='z')?('A' + c1 -'a'):c1;
printf("
The upper case equivalent is ");
for (j=0;j<i;j++)
putchar(c2[j]);
return;
}

 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved copyright 123ENG