/* Binary to ASCII Converter (15pt) Write a complete C program that takes a message encoded in binary and prints its letters in ASCII format on the screen. You can assume that the message is stored in a two dimensional integer array which is hardcoded in the program. In other words, you don't have to read it from the keyboard. The following will suffice: int len = 3; // number of letters int message[3][8] = {{0,1,0,0,0,0,1,1}, // C {0,1,1,0,0,0,0,1}, // a {0,1,1,1,0,1,0,0}}; // t To test the program you can keep several messages (commented out) and uncomment only one for testing. For example, here is another one: int len = 5; int message[5][8] = {{0,1,0,0,1,0,0,0}, // H {0,1,1,0,0,1,0,1}, // e {0,1,1,0,1,1,0,0}, // l {0,1,1,0,1,1,0,0}, // l {0,1,1,0,1,1,1,1}}; // o Each letter of the message is encoded as an 8-bit binary number, which corresponds to the ASCII code of the letter. The binary digits for each letter are stored in a separate row of the array. The program must first print the message in binary (one 8-bit number per line) and then print the decoded message in ASCII (see the sample runs below). Sample Run #1: 01000011 01100001 01110100 Cat Sample Run #2: 01001000 01100101 01101100 01101100 01101111 Hello Sample Run #3: 01001000 01100001 01101100 01101100 01101111 01110111 01100101 01100101 01101110 Halloween */ #include #include #include int main() { // Uncomment only one of these to test this program /* int len = 3; // number of letters int message[3][8] = {{0,1,0,0,0,0,1,1}, // Cat {0,1,1,0,0,0,0,1}, {0,1,1,1,0,1,0,0}}; */ /**/ int len = 5; int message[5][8] = {{0,1,0,0,1,0,0,0}, // Hello {0,1,1,0,0,1,0,1}, {0,1,1,0,1,1,0,0}, {0,1,1,0,1,1,0,0}, {0,1,1,0,1,1,1,1}}; /**/ /* int len = 9; int message[9][8] = {{0,1,0,0,1,0,0,0}, // Halloween {0,1,1,0,0,0,0,1}, {0,1,1,0,1,1,0,0}, {0,1,1,0,1,1,0,0}, {0,1,1,0,1,1,1,1}, {0,1,1,1,0,1,1,1}, {0,1,1,0,0,1,0,1}, {0,1,1,0,0,1,0,1}, {0,1,1,0,1,1,1,0}}; */ /* int len = 14; int message[14][8] ={{0,1,0,1,0,0,1,1}, // Secret Message {0,1,1,0,0,1,0,1}, {0,1,1,0,0,0,1,1}, {0,1,1,1,0,0,1,0}, {0,1,1,0,0,1,0,1}, {0,1,1,1,0,1,0,0}, {0,0,1,0,0,0,0,0}, {0,1,0,0,1,1,0,1}, {0,1,1,0,0,1,0,1}, {0,1,1,1,0,0,1,1}, {0,1,1,1,0,0,1,1}, {0,1,1,0,0,0,0,1}, {0,1,1,0,0,1,1,1}, {0,1,1,0,0,1,0,1}}; */ int i, j; for(i=0; i