Question: 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

 C programming You are given a secret message and must decodeit. Your secret message is this: .v51aaT&vh" 154" :5h41h15env" "sv85TsvvF sns .SCA

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!