0% found this document useful (0 votes)
30 views9 pages

Programme of Toupper

The document contains code to convert text entered by the user into Morse code representations. It takes in a string from the user, then iterates through each character, uses a switch statement to check the character and assign the appropriate Morse code dots and dashes pattern to a new string. It then prints out the resulting Morse code string.

Uploaded by

Himanshu Soni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views9 pages

Programme of Toupper

The document contains code to convert text entered by the user into Morse code representations. It takes in a string from the user, then iterates through each character, uses a switch statement to check the character and assign the appropriate Morse code dots and dashes pattern to a new string. It then prints out the resulting Morse code string.

Uploaded by

Himanshu Soni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

#include<stdio.

h>
#include<conio.h>
#include<string.h>
#include<process.h>
void main()
{
char str[25],str1[100];
clrscr();
fflush(stdin);
printf("enter the String");
gets(str);
int j=0;
for(int i=0;i<=strlen(str);++)
{
switch(toupper(str[i]))
{
case 'A':
str1[j++]='.';
str1[j]='.';
break;
case 'b':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'c':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'D':
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'E':
str1[j]='.';
break;
case 'F':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'G':
str1[j++]='.';
str1[j++]='.';

str1[j]='.';
break;
case 'H':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'I':
str1[j++]='.';
str1[j]='.';
break;
case 'J':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'K':
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'L':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'M':
str1[j++]='-';
str1[j]='-';
break;
case 'N':
str1[j++]='-';
str1[j]='.';
break;
case 'O':
str1[j++]='-';
str1[j++]='-';
str1[j]='.';
break;
case 'P':
str1[j++]='.';
str1[j++]='-';
str1[j++]='-';
str1[j]='.';
break;

case 'Q':
str1[j++]='-';
str1[j++]='-';
str1[j++]='.';
str1[j]='.';
break;
case 'R':
str1[j++]='.';
str1[j++]='-';
str1[j]='.';
break;
case 'S':
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'T':
str1[j]='-';
break;
case 'U':
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'V':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case 'W':
str1[j++]='.';
str1[j++]='-';
str1[j]='-';
break;
case 'X':
str1[j++]='-';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case 'y':
str1[j++]='-';
str1[j++]='.';
str1[j++]='-';
str1[j]='.';
break;

case 'Z':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case '0':
str1[j++]='-';
str1[j++]='-';
str1[j++]='-';
str1[j++]='-';
str1[j]='-';
break;
case '1':
str1[j++]='.';
str1[j++]='.';
str1[j++]='-';
str1[j++]='-';
str1[j]='-';
break;
case '2':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case 'F':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case '3':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='-';
str1[j]='.';
break;
case '4':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '5':
str1[j++]='.';
str1[j++]='.';

str1[j++]='.';
str1[j++]='.';
str1[j]='.';
break;
case '6':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '7':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '8':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '9':
str1[j++]='-';
str1[j++]='-';
str1[j++]='-';
str1[j++]='-';
str1[j]='.';
break;
case '.':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case ',':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case ':':
str1[j++]='.';

str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '?':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
/* case '\';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break; */
case '-':
str1[j++]='-';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case ';':
str1[j++]='-';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='-';
str1[j]='.';
break;
case '(':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case ')':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';

str1[j++]='.';
str1[j]='-';
break;
case ']':
str1[j++]='-';
str1[j++]='.';
str1[j++]='.';
str1[j++]='-';
str1[j++]='-';
str1[j]='-';
break;
case '[':
str1[j++]='-';
str1[j++]='.';
str1[j++]='.';
str1[j++]='-';
str1[j++]='-';
str1[j]='.';
break;
case '}':
str1[j++]='-';
str1[j++]='.';
str1[j++]='-';
str1[j++]='-';
str1[j++]='.';
str1[j]='-';
break;
case '{':
str1[j++]='-';
str1[j++]='.';
str1[j++]='-';
str1[j++]='-';
str1[j++]='.';
str1[j]='-';
break;
case '"':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '+':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;

case '/':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '%':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '&':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '$':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '*':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '^':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '#':
str1[j++]='.';

str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '@':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='-';
break;
case '=':
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j++]='.';
str1[j]='';
break;
}
j++;

}
str1[j-1]='\0';
puts(str1);
getch();

You might also like