Function to implement with this prototype: void encode_phrase(char input_phrase[
ID: 3657624 • Letter: F
Question
Function to implement with this prototype: void encode_phrase(char input_phrase[], char encoded_phrase[], int array_height, int array_width) second function to implement with prototype: void decode_phrase(char encoded_phrase[], char decoded_phrase[], int array_height, int array_width) You can use fgets() . OUTPUT SHOULD LOOK LIKE THIS: Enter array width, array height:3,5 Enter a phrase (up to 15 characters): The quick brown fox jumps over the lazy dog. Encoded phrase: T i ohqcbweukrn Decoded phrase: The quick brown Enter array width, array height:41,2 Invalid input! Enter array width, array height:8,10 Enter a phrase (up to 80 characters): The quick brown fox jumps over the lazy dog. Encoded phrase: Tkfshd h o eo ebxo g r vl. qojea uwurz inm y c pt Decoded phrase: The quick brown fox jumps over the lazy dog. Enter array width, array height:8,10 Enter a phrase (up to 80 characters): This is really a very good test of the quick brown fox jumped over the lazy dog. Encoded phrase: Tr oouwueahevdfinmrziae c p yslrttkfet lyeh odhdiy sebx eos gt r o g ao qojvl. Decoded phrase: This is really a very good test of the quick brown fox jumped over the lazy dog.Explanation / Answer
#include #include #include void main(){ charstring[50],tmp[50]; int spcnt[50],i,j,c; clrscr(); printf("Enter a string : "); gets(string); //encode logicfor(i=0;string[i];i++){ string[i]=string[i]+3; } textcolor(GREEN); printf(" "); cprintf("Encoded string is as follow : %s",string); //decompressed logicfor(i=0;string[i];i++){ string[i]=string[i]-3; } textcolor(GREEN); printf(" "); cprintf("De-Encoded string is as follow : %s",string); getch(); }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.