Question: This code needs encrypt a text without changing and below that needs to be decrypted without changing the code. I also need to print each

This code needs encrypt a text without changing and below that needs to be decrypted without changing the code. I also need to print each alphabetical letter with its letter frequency.

Thanks in advance

//encryption part

#include #include

int main() { FILE* input = stdin; FILE* output = stdout; char c,k='K'; while ((c=getc(input)) != EOF) { /*Your code here*/ putc(c,output); } }

**************************************************************************************************************

decryption part

#include #include #include

void check(int argc, char* argv[]) { if (argc != 2) { puts("usage: $ ./decrypt keychar"); exit(1); } if (! isalpha(argv[1][0])) { puts("key character must be alphabetical"); exit(1); } if (argv[1][0] != toupper(argv[1][0])) { puts("key character must be upper case"); exit(1); } }

int main(int argc,char* argv[]) { check(argc,argv); char k = argv[1][0]; printf("key = %c ",k); FILE* input = stdin; FILE* output = stdout; char c; while ((c=getc(input)) != EOF) { /*YOUR CODE HERE*/ putc(c,output); } }

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!