Question: LANGUAGE: C++ Write the program exactly the way the instructions are given. Givens: key-decodeSentence.run (OP repository) Description: Design and write a program to process an
LANGUAGE: C++ Write the program exactly the way the instructions are given. Givens: key-decodeSentence.run (OP repository) Description: Design and write a program to process an input line representing a coded message of up to 8 (scrambled) words, and to print out the decoded message with the words in the correct order, followed by ONE SPACE and terminated by two periods (..). NOTE: "word" means a sequence of characters with no spaces. Input format:... 0-| Example: 1This 4fast. 3is 2cat 0-| ` Output Lines: ENCODED: 1This 4fast. 3is 2cat 0-| DECODED: This cat is fast. .. ENCODED: 0This 5fast. 11is 33cat 0-| DECODED: fast. .. ENCODED: 9This 12fast. 11is 9cat 0-| DECODED: .. DESIGN CONSTRAINTS: (1) Prompt for entire input line: Enter ENCODED Sentence: Note: Input must be the entire line terminated by 0-| (2) Use the data type defined below to arrange the words in order: struct SENTENCE { string word1; string word2; string word3; string word4; string word5; string word6; string word7; string word8; }; (3) Before reading inputs, initialize each word to the empty string. (4) Use a while loop to process the inputs. (5) The loop body must contain a switch based on the word position. (6) If multiple words specify the same position, the earlier word must be replaced by the later one. Example: 4a 2b 1c 4x 2z 0-| ==> c z x .. KEY PROGRAM: in public repository, key-decodeSentence.run Run it to see how your program must behave.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
