Homework #2 Secret Code Solution

$30.00

Description

For this homework assignment, you will be given a text document with a secret code. The text document contains a series of lowercase words, each on a separate line. Some worlds will have letters replaced with uppercase letters or numbers. The secret code is all the capital letters put together and the sum of the numbers.

Here is a list of what you must do:

Open the file Words.txt to be read Store each word in a vector

Output the list of words to the terminal

Go through the vector checking each character of each string If an uppercase letter, add it to the word

If a number, add it to a sum of all numbers Output the secret code to terminal

Save the secret code to a file called abc1234_Secret_Code_1.txt

Append the secret code to the end of the text document that came with the homework

Bonus (10 pts)

The bonus for this homework will work the same as the full credit but with two exceptions. The first is that you will use the file Bonus_Words.txt. The second that if you see two numbers next to each other, that is a two digit number, not 2 separate numbers.

Deliverables

You will submit your code and screen shots of your code working via Blackboard. You will upload a ZIP file, named “abc1234_HW1.zip”, containing 2 files (5 if you did bonus):

abc1234_Secret_Code_1.cpp (source code) Words.txt

abc1234_Secret_Code_1.png (screen shot of program running) abc1234_Secret_Code_1.txt

abc1234_Secret_Code_2.cpp (source code) Bonus_Words.txt

abc1234_Secret_Code_2.png (screen shot of program running) abc1234_Secret_Code_2.txt

When you submit your file, leave the GTA instructions on how to compile your code and run it. Note: he will be using terminal on the virtual machine that I used in class. Instructions can be included as a comment on blackboard or in a README.txt file.

Full credit files named incorrectly result in a loss of 5 points each. Bonus files named incorrectly will result in a loss of 1 bonus point each.


error: Content is protected !!