Question: I need help in writing a Huffmans code encoder specifically in C++. The sample input: The sample output (code): The sample output (encodemsg): You are
You are required to write a Huffman code encoder Details Name your program as "hmencoder". Usage of hmencoder: hmencoder [input file] where input file is the file containing the input message The input message contains normal English text. You need to encode all English letters together with all printable characters such as".", ",", "!", space etc. The capital letter and the corresponding small letter are treated as two symbols. For example, "A" and "a" are regarded as two symbols. Here we don't consider carriage return. In other words, you only need to consider the characters from "space" to ~'in the ASCII table. The output of hmencoder should have two output files, "code.txt" and "encodemsg.txt". . The output file "code.txt" stores the codeword for each symbol and the average number of bits used for each symbol. The format of this output file is as follows: Each row contains the codeword for a separate symbol, the symbols are listed according to the increasing order of the corresponding ASCII code value. The last row shows the average number of bits used for each symbol. Space: 000 : 001 A: 0100 z: 1000 Ave 3.43 bits per symbol The output file "encodemsg.txt" stores the encoded message with 80 0/1 characters on each row (except the last row)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
