Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I NEED THIS ASSIGNMENT IN C PROGRAMMING LANGUAGE NOT IN C++. PLEASE DO IT IN C PROGRAMMING. You will write a program which asks for

image text in transcribed

image text in transcribed

I NEED THIS ASSIGNMENT IN C PROGRAMMING LANGUAGE NOT IN C++. PLEASE DO IT IN C PROGRAMMING.

You will write a program which asks for a text file and a offset and encrypts/decrypts the given file using the given offset (Caesar Cypher). 1. (10%) Your program should always operate in a loop, continually asking if the user wishes to continue until the user enters "no", "No", "n", or "N. 2. (10%) If the user doesn't wish to quit your program should ask the user if they want to encode or decode a file. The user should enter either "encode" or "decode" (anything else, and you ask again.) 3. (40%) if the user wishes to encrypt: a. (5%) Ask the user for the file name b. (5%) Ask the user for an offset (offset) c. (5%) Ask the user for the output file name d. (5%) Encrypt the input text file using the following scheme: 1. Select a random number between 0 and 10 and add to the offset (offset2) Il Select a random number between 0 and 10 and add to the offset (offset3) ill. In the output file, write the two random offsets using the character code that represents the random number ('a'-> 0, 'b'->1 and so on) on a line by itself. iv. Now loop through the file, line by line, character by character replacing characters: 1. If the character is an alphabetic character (a-z or A-2), use the offset in a 1, 2, 3 pattern to replace the character with the character offset (1E, if your offset is 3 and your character is 'a' -> 'a' + 3 = 'd' and don't forget to wrap around 26) 2. In this process, be sure to keep everything else the same (punctuation, spaces, etc). V. Close the input and output files. 4. (40%) if the user wishes to decrypt: a. (5%) Ask the user for the file name b. (5%) Ask the user for an offset (offset) c. (5%) Ask the user for the output file name d. (5%) Encrypt the input text file using the following scheme: I. Read the input text's first line and first two characters to determine offset2 and offset 3. II. Now loop through the file, line by line, character by character replacing characters: 1. If the character is an alphabetic character (a-z or A-Z), use the offset in a 1, 2, 3 pattern to replace the character offset with the character offset (IE, If your offset is 3 and your character is 'd' -> 'd' - 3 = 'a' and don't forget to wrap around 0) o 2. In this process, be sure to keep everything else the same (punctuation, spaces, etc). Graduate Students: (50%) in the encrypt and decryption processes, offer the user a choice between a Caesar cipher (above) and a Random replacement cipher (below): Encrypt: 1) Create an array consisting of letters 'a' through 'z' 2) Shuffle them (randomly replace the characters in the array 26*4 times) 3) Write them to output file using the offset given (still need the offset) on a line by themselves. 4) Now, as you read through the input file, replace each character (only if alphabetic) with the letter corresponding with its position. (for instance if our array consists of 'sdfk... and the letter to replace is 'a', 'a' -> 0, so array[0] which is 's'; (in this case) Decrypt: 1) Read the first line of the input file and using the given offset store the array of characters. 2) Now, as you read through the input file, replace each character (only if alphabetic) with the letter corresponding with its position. (for instance if our array consists of 'sdfk... and the letter to replace is 's', 's' is at position 0, so we replace 's' with 'a'; (in this case)

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_2

Step: 3

blur-text-image_3

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

What are the three formal responsibilities of a board of directors?

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago