Friday, April 10, 2015

3.Write a program to input a massage from keyboard and display the menu. a) Print the message length in terms characters. b) Print the message in reverse order. c) Print the message in capital letters. d) Copy the message from one location of screen to another location.


#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
int choice;
char message[50],temp[50];
printf("\nl. Message Length");
printf("\n2. Message in Reverse order");
printf("\n3. Message in Capital order");
printf("\n4. Copy message from one location to another location");

printf("\nInput your message:— ");
gets(message);
printf("\nInput Your Choice:— ");
scanf("%d",&choice);
switch(choice)
{
case 1:
       printf("\n Length = %d",strlen(message));
       break;
case 2:
       printf("\n Reverse order = %s",strrev(message));
       break;
case 3:
       printf("\n Message in Capital = %s",strupr(message));

       break;
case 4:
       strcpy(temp,message);
       printf("\n Copied message = %s",temp);

default:
       printf("\n Invalid Choice");
       break;
}
getch();

No comments:

Post a Comment