Program 247: Visit Morse Code encryption
The above can also be done using switch case but you need to write a total of 35 cases which is not a good practice.
//Coming Soon
Output:
#include<stdio.h> #include<string.h> #include<stdlib.h> main() { int i=0,j=0,k=0,flag=0; char *alphamorse[]={".-","-...","-.-.","-..",".","..-.","--.","....","..",".---", "-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-", "...-",".--","-..-","-.--","--.."}; char *nummorse[]={"-----",".----","..---","...--","....-",".....","-....","--...","---..","----."}; char morseCode[1000]={0},substr[1000][100]={0},c; printf("Enter a Morse Code with spaces\n"); gets(morseCode); while(morseCode[k]!='\0')//for splitting sentence { j=0; while(morseCode[k]!=' '&&morseCode[k]!='\0') { substr[i][j]=morseCode[k]; k++; j++; } substr[i][j]='\0'; i++; if(morseCode[k]!='\0') { k++; } } int len=i; for(i=0;i<len;i++) { for(j=0;j<25;j++) { if(!strcmp(alphamorse[j],substr[i]))//strcmp returns 0 if they are same { printf("%c",(j+65)); break; } } for(j=0;j<9;j++) { if(!strcmp(nummorse[j],substr[i])) { printf("%d",j); break; } } } printf("\n"); }Explanation:
The above can also be done using switch case but you need to write a total of 35 cases which is not a good practice.
//Coming Soon
Output:
How do I
ReplyDeleteEncryption and decryption between users in morse using a flashlight
Bitcoin money is a cryptocurrency fork of Bitcoin exemplary. It was made in august 2017. It is significant that Bitcoin money builds the size of squares, which permits more exchanges to be prepared. bitcoin mixer
ReplyDeleteHi, I'm trying this code, but it's not translating letter "Z" and I cannot figure out why...
ReplyDeleteCan you explain me this code?
ReplyDelete