Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In addition to accept an input of no more than 5000 characters, You may assume t

ID: 645056 • Letter: I

Question

In addition to accept an input of no more than 5000 characters,

You may assume that no word in the input will have more than 25 characters. Either a space or a tab character ( ) will separate words. Write a c program that will accept the cipher text that is terminated ethier by an end of file or end of line character.

Your intelligence agents have assured you the word "Zippy" ( case sensitive) is part of the encrypted text and the message has been encrypted with the caeser cipher. your program must print out the decrypeted text.

Here is the cipher code, if needed!.
#include

void encrypt(int shift);

int main(void)
{
   int shift;
   int decoding;
  
   printf("Amount of shifts: ");
   scanf("%d", &shift);
   if (shift < 0)
   {
       printf("Bad Input.");
       return 0;
   }
   printf("Type 1 to encrypt or 0 to decrypt: ");
   scanf("%d", &decoding);
   if (decoding != 0 && decoding !=1)
   {
       printf("Bad Input.");
       return 0;
   }
   while(getchar() != ' ');
   if (decoding == 1)
       encrypt(shift);
   else
   {
       shift = -1 * shift;
       encrypt(shift);
   }
   return 0;
}

void encrypt(int shift)
{
   char ch;
   printf("Please enter a string: ");
   ch = getchar();
   while(ch != ' ')
   {
       if (ch == ' ')
           putchar(ch);
       else
       {
           if(shift == 1)
               putchar(ch + shift);
           else
               putchar(ch - shift);
       }
       ch = getchar();
   }
   putchar(ch);
}

Explanation / Answer

#include #include #define MAXSIZE 1024 void encrypt(char*); void decrypt(char*); int menu(); int main(void) { char c, choice[2], s[MAXSIZE]; while(1) { menu(); gets(choice); if((choice[0]=='e')||(choice[0]=='E')) { puts("Input text to encrypt->"); gets(s); encrypt(s); } else if((choice[0]=='d')||(choice[0]=='D')) { puts("Input text to decrypt->"); gets(s); decrypt(s); } else break; } return 0; } void encrypt(char*str) { int n=0; char *p=str, q[MAXSIZE]; while(*p) { if(islower(*p)) { if((*p>='a')&&(*p='D')&&(*p
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote