Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help! Programming in C. Having issues solving this problem. Some of the code inside of the program you are not allowed to change and

image text in transcribed

Please help! Programming in C. Having issues solving this problem. Some of the code inside of the program you are not allowed to change and is as follows;

#include

#include

#include

#include

// ---------------------- DO NOT MODIFY THIS SECTION --------------------------------

#define MAX_PGRAPH_LENGTH 100

#define MAX_WORD_LENGHT 20

int main(void) {

// definitions

char plaintext[MAX_PGRAPH_LENGTH];

char ciphertext[MAX_PGRAPH_LENGTH] = "";

char input[MAX_WORD_LENGHT];

// read the key

int key;

scanf("Key: %d, ", &key);

// read text

scanf("Input: ");

while (true)

{

scanf("%s", input);

if (strlen(ciphertext) + strlen(input) + 1 > MAX_PGRAPH_LENGTH)

break;

strcat(ciphertext, input);

strcat(ciphertext, " ");

}

ciphertext[strlen(ciphertext) - 1] = '\0';

// ---------------------- -----------------------------------------------------------

/*

Your code goes here!

*/

// ---------------------- DO NOT MODIFY THIS SECTION --------------------------------

printf(" Key: %d ", key);

printf(" Input: %s ", ciphertext);

printf("Output: %s ", plaintext);

// ---------------------- -----------------------------------------------------------

}

13.12 Caesar Cipher v3 (Decryption) A Caesar cipher is one of the first and most simple encryption methods. It works by shifting all letters in the original message (plaintext) by a certain fixed amount (the amounts represents the encryption key). The resulting encoded text is called ciphertext. Example Key (Shift): 3 Plaintext: Abc Ciphertext: Def Task Your goal is to implement a Caesar cipher program that receives the key and an encrypted paragraph (with uppercase and lowercase letters, punctuations, and spaces) and decrypt it. Requirements Only letters must be decrypted, any other character must remain unchanged Note: The whole paragraph is going to be given to you as a string (char array). Review the template code for more details LCTVITY 13.12.1: Caesar Cipher vs (Decryption) 0/30 decrypt.c Load default template... 1 #include 2 #include stdbool.h> #include #include 4 DO NOT MODIFY THIS SECTION-- 7 #define MAX PGRAPH LENGTH lee 8 #define MAX WORD LENGHT 2e int nain(void) ( 11 / definitions 12 char plaintext [MAX PGRAPH LENGTH]: 3 char ciphertext [MAX PGRAPH LENGTH] - 14 char input [MAX WORD LENGHT] 16 read the key 7int key 18 scanf("Key: %d, "" &key); 2 read text 1SCanf Input: When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading. Develop mode Submit mode

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

Icdt 88 2nd International Conference On Database Theory Bruges Belgium August 31 September 2 1988 Proceedings Lncs 326

Authors: Marc Gyssens ,Jan Paredaens ,Dirk Van Gucht

1st Edition

3540501711, 978-3540501718

More Books

Students also viewed these Databases questions

Question

friendliness and sincerity;

Answered: 1 week ago