Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming You are given a secret message and must decode it. Your secret message is this: .v51aaT&vh 154 :5h41h15env sv85TsvvF sns .SCA 15 fs*4av

image text in transcribedimage text in transcribed

C programming

You are given a secret message and must decode it. Your secret message is this: .v51aaT&vh" 154" :5h41h15env" "sv85TsvvF sns .SCA 15 fs*4av [4s In*4*4 ST sT? nv. sv4av4 aeTsa4he th&ve554 nTs hT4e neas vn -a55v1e Yes, it's in a secret code. But, you know the secret. Each character in the message equals some bits in the output string. Your code is this: Code Bits 000 001 010 011 100 101 110 111 & 5 00 01 10 11 4 Each character becomes some bits. For example, supposed you got the codes for these bits: 010 010 00 01 10 010 101 101 100 01 101 100 011 011 110. If you think of those as sequential bits, most significant bit first, you can group them in groups of 8 and you get this: 01001000 01100101 01101100 01101100 01101111 0. Those turn out to be the ASCII codes for "Hello". All you have to do is read the code one character at a time, and generate the bits for the decoded output as a character string. The function you will fill in will be this: /** * Decode an encoded string into a character stream. * @param encoded The input string we are decoding @param decoded The output string we produce * @param maxLen The maximum size for decoded */ void decoder (const char *encoded, char *decoded, int maxLen) { Here is a simple main program to test that your solution works. Note that this does not test every possible way the program may be used, but if your solution works you will get an output string that is English, not gibberish. int main() reh&i shaTv nuny5sh&5" vsvv 4*e 41hse "5v sv 45Tsvv5: 15hv54h 's5145h. *4sz 5e5nT4 3*1 -+nasn e554 14e45 Svsheh e*s4 15 s11e4 v5shen- va&sa4* char decoded[1000]; decoder(encoded, decoded, sizeof(decoded)); printf("Xs", decoded); return 0; You are given a secret message and must decode it. Your secret message is this: .v51aaT&vh" 154" :5h41h15env" "sv85TsvvF sns .SCA 15 fs*4av [4s In*4*4 ST sT? nv. sv4av4 aeTsa4he th&ve554 nTs hT4e neas vn -a55v1e Yes, it's in a secret code. But, you know the secret. Each character in the message equals some bits in the output string. Your code is this: Code Bits 000 001 010 011 100 101 110 111 & 5 00 01 10 11 4 Each character becomes some bits. For example, supposed you got the codes for these bits: 010 010 00 01 10 010 101 101 100 01 101 100 011 011 110. If you think of those as sequential bits, most significant bit first, you can group them in groups of 8 and you get this: 01001000 01100101 01101100 01101100 01101111 0. Those turn out to be the ASCII codes for "Hello". All you have to do is read the code one character at a time, and generate the bits for the decoded output as a character string. The function you will fill in will be this: /** * Decode an encoded string into a character stream. * @param encoded The input string we are decoding @param decoded The output string we produce * @param maxLen The maximum size for decoded */ void decoder (const char *encoded, char *decoded, int maxLen) { Here is a simple main program to test that your solution works. Note that this does not test every possible way the program may be used, but if your solution works you will get an output string that is English, not gibberish. int main() reh&i shaTv nuny5sh&5" vsvv 4*e 41hse "5v sv 45Tsvv5: 15hv54h 's5145h. *4sz 5e5nT4 3*1 -+nasn e554 14e45 Svsheh e*s4 15 s11e4 v5shen- va&sa4* char decoded[1000]; decoder(encoded, decoded, sizeof(decoded)); printf("Xs", decoded); return 0

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_2

Step: 3

blur-text-image_3

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

Samsung Galaxy S23 Ultra Comprehensive User Manual

Authors: Leo Scott

1st Edition

B0BVPBJK5Q, 979-8377286455

More Books

Students also viewed these Databases questions

Question

2. What are the five dimensions of big data?

Answered: 1 week ago

Question

Define marketing concepts.

Answered: 1 week ago

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago

Question

1. Identify three approaches to culture.

Answered: 1 week ago

Question

3. Identify and describe nine cultural value orientations.

Answered: 1 week ago

Question

4. Describe how cultural values influence communication.

Answered: 1 week ago