subject

Create a program that applies a simple "substitution cipher" to the contents of a text file and writes the encrypted text back to the file. A substitution cipher is given a key word and uses the unique characters from that word to generate a cipher alphabet. Suppose "feather" is used as the key. The following cipher alphabet will be generated: FEATHRZY X W V US OPON MLKJIGD CB A B C D E F G H I J K L M N O P Q R S T U V W X Y Z FEATHRZY X W V USO PONMLKJIGDCB Using this cipher alphabet, read in a text file and replace each character with the corresponding cipher alphabet character (e. g., A -> F) when encoding and vice versa when decoding. In addition to being able to encode or decode, your application should utilize command line input parameters, with the following format: passing -e/-d to your program will cause the file to either encrypt or decrypt using the specified key. passing -k followed by a word will specify the key (e. g., -k feather) (you can use any word for the key you want). the last two strings will denote the input file and output file, respectively. Example: ./test -e -k feather input. txt output. txt
Assuming your compiled program was called "test", this line will read in input. txt, encrypt the text using the cipher alphabet generated by feather to the contents and write them to output. txt. Note: you will only apply the encryption alphabet to characters and leave spaces and punctuation alone. Hints: Use the file stream objects for reading and writing to your files. Use the getline() member function of the file streamer to get entire lines of strings from the input source. Don't forget to use the library for helpful functions for analyzing command line parameters. Also, when developing your cipher encryption, save dealing with capital letters for last. It's an easy conversion that can be applied during the encryption/decryption process.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:30, shubbs1038a
Your boss wants you to configure his laptop so that he can access the company network when he is on the road. you suggest a vpn connection to him. he is very concerned about security and asks you how secure vpn is. what do you tell him?
Answers: 1
image
Computers and Technology, 24.06.2019 08:00, ineemorehelp
Arah has entered data about football players from team a and team b in a worksheet. she enters names of players from team a with details about each player in different columns of the worksheet. similarly, she enters details of all the players from team b. which option will her view the data for team a and team b in two separate sections after printing? a. page break view b. freeze pane view c. split screen view d. full screen view e. zoom out view
Answers: 1
image
Computers and Technology, 24.06.2019 11:00, dirttrackr75
Which of the statements below describe the guidelines for the use of text in presentation programs? a. do not use numbered lists. b. fonts should be appropriate for your audience. c. limit the number of fonts you use to three or four. d. only use bulleted lists for sales promotions. e. select font sizes that are appropriate for your delivery method. f. use font colors that work well with your background. select all that apply
Answers: 1
image
Computers and Technology, 24.06.2019 17:40, katherinemoreno353
Write a program to analyze student’s scores. each student’s id and 4 original test scores are saved in the attached file “student_id_scores. txt”. assume there are exactly 15 students in the class.• the program first opens the file, reads student’s ids and scores from the file and saves them in two arrays: o create a one-dimensional string array “ids” to store the student’s ids. o create a (parallel) two-dimensional int array “scores” to store student’s original test scores. this array has 5 columns, the original 4 test scores should be saved in the first 4 columns, and the last column will be used to save the average score after the calculation in next step.• the program then retrieves test scores from the array “scores”, calculates average score and determines the final letter grade based on the rules in the table below for each student. assume average score is integer value. average score = (score1 + score2 + score3 + score4) / 4average score letter grade90 ~ 100 a80 ~ 89 b70 ~ 79 c60 ~ 70 d0 ~ 60 f• the average score should be saved back in the 5th column of “scores” array.• create a new parallel one-dimensional char array “grades” to save each student’s letter grade.• program also needs to find the number of a, number of b, number of c, number of d and number of f grade. as well as the highest, lowest and average score of the class.• finally, program will display all of the original scores and all results on the computer screen using the format shown as the sample output below.• the program must contain at least the following functions: (1) a function “getscores” to read and store data into “ids” and “scores” arrays.(2) a function “analyzescores” to calculate student’s average score, determine letter grade, get the number of a, b, c, d and f, find the highest, lowest and average score of the class.(3) a function “displayresults” to display all of the results
Answers: 3
You know the right answer?
Create a program that applies a simple "substitution cipher" to the contents of a text file and writ...

Questions in other subjects:

Konu
Mathematics, 30.08.2019 18:50