You are given a secret message and must decode it. Your secret message is this:
sa4**5nha*4n545*5h5v451shvhT&vhvnT4*e*5evse4n*5*h&neh5avn4an
T&1s&n55nh5e45*1*5s4a545h*Tanvv4svsehhTTh4sn1h1s4v5Te5Ta*Ts5
Tsa4hshaTvhvnT&s*5h&sv4a5sh4T&sssTen5v55Te5*54h1she5T5ss4n54
hvnv5sh&5T4T4ha1hhnhh5n1vsvv4*T4as1*v4avT4T&a*4s55ev1n5se*1v
411v4sns*4n*5*h4e4nTsv51h4*e*s4nh4hh514Tavn54ss&n5e554545Tv*
e11naa5v4aa4sT5e5n4sv4av4aa41hse*nv55nhh5ah1na4Tssehe*e5e55&
a5Te5Te**Tse*nv51aaT&vh5511sshhss*4545*5hvnens45v&vne*shvh&n
n4ne*e5e5ne5h41h15env51*51has4saTss5e55&5vT4vT5s1sn1s4vev1sv
seh*hv*4n5&sv&5Tsvv5s*55heTsvT&ehvnheh41hnv5sTes*5ne*shssnv5
se4nhvhTn*e*1h15hv54ha1nssTs*4avh4hnvvh*T4snsTh5Th5she**T5h5
5s4sv&1*ha*h4e&s5145haThT1n*4*4sa&5h5e55Tenh441hhh4ee&5Tssh5
sv55nhhvhe41ss&n5e5nT4h414sTas*1nvv4h&1aa4151155hvnhnnhaha5v
4neTe**Tshhss4n**554nsshsvsse5ev1vss*4nhave5n4sv4av45*1sTn15
5hv541ss4hasv5s4551hashsaTnh4ass*4*Thh&nhav54aeTsa4h&shah4se
5hT5sv55nhhv*5hsnnv5sT&s*5hTT5TTvevshhh1s&she*h&ve554Ts11T4h
*n5vshehT4h5evs&5h414sThh&5h5hvnTs*e*s4sv4*5shehT4e454hss4vh
vna4h45*nv51h1shh51vs1seshT5avneashssnvv4hsne*1*s11e4as1hese
*see5h5vv4av*54neT&h&nne*1h45Tsa&5h5e5nhe*h&vev15n5ev1hs*hss
se11shn4a*hsv4nssehvh5vTnhT441hsnh4e4na4ha5e5n*&shsh5hvnTh5T
e5Tsaa5515&s45eTsaTv*Tenv5shsss*h54Ta4hs*heh4vaT4ea55v1s5nas
eTshhs1na415seenvvT&*eT5hvn4anhenhsaa5vT5eTss1va&sa4*v4aa45T
s4ssshT5a5v45snhah&ehT4TT&5Ts55hveh555e5v
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
V 000
n 001
a 010
1 011
e 100
* 101
T 110
& 111
5 00
S 01
h 10
4 11
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 ðecoder(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()
{
const char *encoded=”\
sa4**5nha*4n545*5h5v451 shvhTS,vhvnT4*e*Sevse4n*5*h8neh5avn4an\
T&1 s&nSSnh5e45*1 *5s4a545h*Tanvv4svsehhTTh4sni hi s4vSTe5Ta*Ts5\
Tsa4hshaTvhvnT&s*5hasv4a5sh4T&sssTen5v55Te5*54h1 sheST5ss4n54\
hvnv5sh&5T4T4hai hhnhh5ni vsvv4*T4asl *v4avT4TSa*4s55evi n5se*1 v\
411 v4sns*4n*5*h4.e4nTsv5l h4*e*s4nh4hh5i 4Tavn54ss&n5e554545Tv*\
eli naa5v4aa4sT5e5n4sv4av4aa4l hse*nv55nhh5ahl na4Tssehe*e5e55&\
aSTe5Te**Tse*nv5l aaT&vh551 1 sshhss*4545*5hvnens45vavne*shvhan\
n4*e5e5ne5h4l hi 5envSi *51 has4saTss5e55&5vT4vT5sl snl s4vevl sv\
sehahv*4n5&svš5Tsvv5s*55heTsvT&ehvnheh4l hnv5sTes*5ne*shssnv5\
se4ihvhTn*e*1 hi Shv54hal nssTs*4avh4hnvvh*T4snsTh5m5she**T5h5\
5s4sv&1 *ha*h4e&551 45haThTi n*4*4sa&5h5e55Tenh441 hhh4ee&5Tssh5\
sv55nhhvhe4l ss&nSe5nT4h4l 4sTas*i nvv4h&1 aa4l 511 55hvnhnnhaha5v\
4neTe**Tshhss4n**554nsshsvsse5evi vss*4nhave5n4sv4av45*1 sTnl 5\
5hv541 ss4hasv5s455l hashsaTnh4ass*4*ThhSnhav54aeTsa4Mshah4se\
5hT5sv55nhhv*5hsnnv5sTšs*5hTT5TTvevshhhl s&she*h&ve554Tsl 1 T4h\
*n5vshehT4h5ev5h41 4sThh85h5hvnTs*e*s4sv4*SshehT4e454hss4vh\
vna4h45*nv5l hi shh5l vsi seshT5avneashssnvv4hsne*i *sl 1 e4asl hese
*s5h54ay*54T&hRnne*i h45Tsa&5h5e5nhe*h&vevi Sn5evl hs*hss\
sell shn4a*hsv4nssehvh5vTnhT44l hsnh4e4na4ha5e5n*&shsh5hvnTh5T\
e5Tsaa55l 5&s45eTsaTv*Tenv5shsss*h54Ta4hs*heh4vaT4eaS5vl s5nas\
eTshhsl na4l 5seenvvT&*eT5hvn4anhenhsaa5vT5eTss 1 va&sa4*v4aa45T\
s4ssshT5a5v45snhah&ehT4fl&5Ts55hveh55Se5v;
char decoded[1000];
decoder(encoded, decoded, sizeof(decoded));
printf(“%s”, decoded);
return 0;
}
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of