Problem Description: Suppose an encrypted file was created using the encoding/de
ID: 654258 • Letter: P
Question
Problem Description: Suppose an encrypted file was created using the encoding/decoding scheme Each letter is substituted by some other letter according to a given mapping as shown below String letters abcdefghijklmnopqrstuvwxyz String enc ''kngcadsxbvfhjtiumylzqropwe For example, every 'a' becomes a 'k' when encoding a text, and every k' becomes an 'a' when decoding. You will write a program, encode or decode a File, and then encodes or decodes the File using the mapping above. Capital letters are mapped the same way as the lower case letters above, but remain capitalized. For example, every 'A' becomes 'K' when encoding a file, and every 'K' becomes an 'A' when decoding. Numbers and other characters are not encoded and remain the same Write a program to read a file and encode the file to an encrypted file. And write a program to get an encrypted file and decode to original file. Your program should prompt the user to enter an input file name and an output file name What should you do? l. Ask for input file name/ output file name (encrypted file). The encrypt using above encode decode. 2. Ask for encrypted file and decoded to original input file 3. Use try and catch only. Do not throw Exception at heading of method.Explanation / Answer
#include #include int main() { char ch, file_name[25]; FILE *fp; printf("Enter the name of file you wish to see "); gets(file_name); fp = fopen(file_name,"r"); // read mode if( fp == NULL ) { perror("Error while opening the file. "); exit(EXIT_FAILURE); } printf("The contents of %s file are : ", file_name); while( ( ch = fgetc(fp) ) != EOF ) printf("%c",ch); fclose(fp); return 0; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.