Question: Create a program that can encode and decode messages. Using the following information: Alphacode function: vector alphacode() {// This returns a vector containing the alphabet

Create a program that can encode and decode messages. Using the following information:

Alphacode function:

vector alphacode() {// This returns a vector containing the alphabet a-z and " " vector temp; for (char c='A'; c

Morsecode function: vector morsecode() { // This function returns a vector containing the morse code vector temp(28); temp[0] =".-"; temp[1] ="-..."; temp[2] ="-.-."; temp[3] ="-.."; temp[4] ="."; temp[5] ="..-."; temp[6] ="--."; temp[7] ="...."; temp[8] =".."; temp[9] =".---"; temp[10] ="-.-"; temp[11] =".-.."; temp[12] ="--"; temp[13] ="-."; temp[14] ="---"; temp[15] =".--."; temp[16] ="--.--"; temp[17] =".-."; temp[18] ="..."; temp[19] ="-"; temp[20] ="..-"; temp[21] ="...-"; temp[22] =".--"; temp[23] ="-..-"; temp[24] ="-.--"; temp[25] ="--.."; temp[26] ="......."; temp[27] ="x"; return temp; }

Create a program that can encode and decode messages. Using the following

Requirements Your program should include the following class class Code public: Code): //Default constructor-loads and uses morse code Code(vectorint> codewords); // constructor loading customized code string encode(vector message) encodes a message consisting of A-Z string decode(vector message) I decodes a message private: vector codewords; 1/ this is a codeword vector parallel to A-Z vector alpha; // this is the vector A-Z vector morsecodeO; //function the vector codewords containing morse code string encode (char x); //returns the codeword for the character x char decode (string c); //returns the character for the codeword c d

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!