Question: 13.11 Caesar Cipher v3 (Encryption) Description A Caesar cipher is one of the first and most simple encryption methods. It works by shifting all letters

13.11 Caesar Cipher v3 (Encryption) Description 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 a paragraph (with uppercase and lowercase letters, punctuations, and spaces) and encrypt it. Requirements Only letters must be encrypted, 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.

#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(plaintext) + strlen(input) + 1 > MAX_PGRAPH_LENGTH)

break;

strcat(plaintext, input);

strcat(plaintext, " ");

}

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

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

\\CODE HERE\\

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

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

printf(" %s ", plaintext);

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

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

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!