Question: **to be coded in C** Here is the code for caesar.c that needs to be modified: #include int main(void) { char ch, cipher[100]; int key;
**to be coded in C**

Here is the code for caesar.c that needs to be modified:
#include
int main(void) { char ch, cipher[100]; int key; int i, n;
printf("Enter a key: "); // take key from user scanf("%d", &key); // normalize key between 0 and 25 key %= 26; if (key
getchar();
printf("Enter a message: "); for (n = 0; n = 'a') && (ch = 'A') && (ch 'Z') { cipher[n] -= 26; } } else cipher[n] = ch; }
printf("Output: "); for (i = 0; i
putchar(' ');
return 0; }
1) Modify Caesar cipher (50 points) Modify your C program, caesar.c, such that the letter shifting logic is in a function called shift () which has the following declaration. void shift (char *ch) Your program must 1. Have a global variable called key where you will store the input key 2. Implement the above function with the letter shifting logic. Notice that the function parameter is a character pointer and returns nothing 3. The main () function must call shift ( function for each of the input character and print/display the final result. Example executions: S gcc-Wall -o caesar caesar.c s./caesar Enter a key: 5 Enter a message: Attack at MIDNIGH!T Output: Fyyfhp y RNISNIMY. s./caesar Enter a key: -5 Enter a message: Fyyfhp fy RNISNLMY Output: Attack at MIDNIGHT
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
