Question: PROG 110: The programming language is C# Write a console program that encodes a sentence, writes out the encoded sentence, then decodes the sentence, and
PROG 110: The programming language is C#
Write a console program that encodes a sentence, writes out the encoded sentence, then decodes the sentence, and writes out the decoded sentence. [1] Ask the user to enter a sentence. Save as a string called original. [2] Create a char array from that sentence. (Look at this weeks PowerPoint) [3] Loop through the array and add 1 to each value. These won't work: charArray[i] += 1; charArray[i] = charArray[i] + 1; but these work, so use these charArray[i]++; (then later in the assignment) charArray[i]--; [4] Assemble a new string called encoded from the char array. (Look at this weeks PowerPoint) [5] Write out the encoded sentence. You have now encoded the sentence. Now to convert it back ... [6] Convert the encoded sentence to a char array [7] Loop through the array and subtract 1 from each value. [8] Assemble a new string called decoded from the char array. [9] Write out the decoded sentence. Here is the output of my version. I suggest you test yours using the same sentence. please enter a sentence to be encoded. the quick brown fox jumped over the lazy fence Here is that sentence encoded. uif!rvjdl!cspxo!gpy!kvnqfe!pwfs!uif!mb{z!gfodf
Here is that sentence decoded. the quick brown fox jumped over the lazy fence
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
