DEVRY COMP 122 Lab 7 Lab Report and Source Code
Check this A+ tutorial guideline at
For more classes visit
COMP 122 Week 7 iLab
The focus of this lab is on using strings. You will have an opportunity to work with both C style strings and the string data type. This lab also gives you an opportunity to use what you have learned previously, including using functions, array processing, repetition, and selection. You will also have an opportunity to work with file input and output.
You are to design and implement a program which does encryption and decryption of data from files. Encryption is the process of taking plain lines of text and performing some algorithmic transformation on the data to create an encrypted line of text which looks nothing like the original. Decryption is the process of taking an encrypted line of text and performing some algorithmic transformation on the data to recover the original line of plain text.
Encryption and Decryption Approach
Our approach to encryption and decryption involves two strings. The first is an encryption / decryption string which we will allow to be up to 128 lower case alphabetical characters in length. The second string is a line of text from a file that is to be encrypted or decrypted.
Our basic strategy for encrypting data is based on mapping alphabetical characters to specific values, then doing some simple mathematical operations to create a new value. First of all, every character in either the encryption string or the input string is mapped to a number between 0 and 25 based on its position in the alphabet.
The mapped value of a character is easily obtained by doing the following:
For lower case characters, subtract 'a' from the character.
For upper case characters, subtract 'A' from the character.
To calculate the modified value of the first character of input we...