Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE: #include #include using namespace std; int main() { cout Assignment #0 (welcome assignment) Problem Solving and Programming in C++ Department of Computer Science Old

image text in transcribed

image text in transcribed

image text in transcribed

CODE:

#include #include using namespace std; int main() { cout   Assignment #0 (welcome assignment) Problem Solving and Programming in C++ Department of Computer Science Old Dominion University Objectives: The main objective of this assignment is to help you review some of the concepts related to functions in C++ as well as working with files. General Instructions: 1. Read the Problem Descriptions below. 2. In this assignment, you will actually start with a working program. 3. Split the single function given into multiple functions. 4. Read the input from a file. 5. Files provided for this assignment can be found on Blackboard. Task Description: The program in CombinationCipher.cpp takes a message written by the user and puts it through multiple ciphers. A cipher is a technique to create a secret code from a message. A combination cipher uses multiple ciphers to encode the same message. This combination cipher uses a keyboard cipher twice and then uses Morse code. The Keyboard Code is just the order of letters your keyboard. The top row is the original letter, bottom row is the encoded letter. ABCDEFGHIJKLMNOPQRSTUVWXYZ QWERTYUIOPASDFGHJKLZXCVBNM The program in CombinationCipher.cpp file works, but it is ugly and harder to understand than it should be. That's because it was written without functions other than main(). As a consequence, a lot of code gets repeated, and the overall logic of the program is hidden by the mass of details. Rewrite the program by grouping the code into functions. Change the program so it takes the input from a file 'input.txt' instead of the terminal. In particular, your program should include the following func- tions: 1. A function named readinput that returns a string containing the message from a file. The parameter should be an fstream passed by reference. 2. A function named uppercase that returns nothing (void). The parameter should be one string containing the user entered message that gets modified to be all upper case letters. Hint: pass by reference. 3. A function named cipher that returns a string containing the fully encoded message. The parameter should be one string containing the uppercase user entered message. 4. A function named translateLetterKeyboard that returns nothing (void). The parameter should be one char containing the letter to be modified, in accordance to the Keyboard cipher. Hint: pass by reference. 5. A function named translateLettermorseCode that returns a string containing the char- acter in morse code. The parameter should be one char containing the letter to be translated, in accordance to Morse code. 6. A function named printoutput that returns nothing (void). The parameters should be two strings, the original user entered message and the final encoded message. This function should print the output. As you introduce each function, replace the code in main() by calls to your new functions as appro- priate. In particular, note that some of these new functions may be called from within the bodies of some of the other functions. Remember that this program was already working. You should not alter the output of the program in any way. Hopefully, once you are done it will be obvious to you that your revised code is simpler and easier to understand than the original. In real life, code that is easier to understand, is easier to get working in the first place, so you should try to develop the code in small, function-based chunks from the very begin- ning. To test your code you can always run inputs through the original .cpp and your own to compare the outputs. Submission notes for Task: Zip the entire Code::Blocks project containing all the .cpp,.h, .cbp files and name the zipped file "Assgo_cslogin.zip", where the eslogin is your login ID for the computers at the Department of Computer Science at ODU. Submission with a different file name other than Assgo_cslogin will receive -10 points off your final points for the assignment. . . Submit the zipped file using the appropriate Blackboard link. Using global variables will cause a 10 point deduction to your final score. Sample output of Task: Assignment - Combination Cipher You Gave me the Message: The quick brown fox jumps over a lazy dog. Your Message Encoded is: Assignment 9- Combination Cipher You Gave me the Message: a b c 1 2 3 Your Message Encoded is

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

define technical writing?

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago