Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer in C. I have included my source code below from previous question. #include # define MAX 1000 void morseEncoder(char * str) { for

Please answer in C. I have included my source code below from previous question.

image text in transcribed

#include # define MAX 1000 void morseEncoder(char * str) { for (int i = 0; str[i]; i++) { switch (str[i]) { case 'A': printf(".- "); break; case 'B': printf("-... "); case 'C': printf("-.-. "); break; case 'D': printf("-.. "); break; case 'E': printf(". "); break; case 'F': printf("..-. "); break; case 'G': printf("--. "); break; case 'H': printf(".... "); break; case 'I': printf(".. "); break; case 'J': printf(".--- "); break; case 'K': printf("-.- "); break; case 'L': printf(".-.. "); break; case 'M': printf("-- "); break; case 'N': printf("-. "); break; case 'O': printf("--- "); break; case 'P': printf(".--."); break; case 'Q': printf("--.- "); break; case 'R': printf(".-. "); break; case 'S': printf("... "); break; case 'T': printf("- "); break; case 'U': printf("..- "); break; case 'V': printf("...- "); break; case 'W': printf(".-- "); break; case 'X': printf("-..-"); break; case 'Y': printf("-.-- "); break; case 'Z': printf("--.. "); break; case ' ': //3 space between each word printf(" "); break; default: printf("? "); } } }

void to_upper_case(char s[]) // lower case to upper case converter { int c = 0; while (s[c]) { if (s[c] >= 'a' && s[c]

int main() { char str[MAX];

printf("Enter the sentence to be converted: "); scanf("%[ ]%*c", str); to_upper_case(str); // conert to uppercase before encoding morseEncoder(str); return 0; }

(2) Reverse Morse Code Write a program called reverseMorseCode.c that takes in a morse code string sequence from the user (as produced from the program above) and converts it back into the original ASCIl sentence as follows Enter the Morse Code sequence: Here is the decoded message: I LOVE C Note that the spacing between the words in the final output is arbitrary and may vary according to whatever you want, as long as the words come out properly. The '?' characters should stay as '? character in the output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

What skills should a DWA possess? Why?

Answered: 1 week ago