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
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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started