you will create a simple program that reads in an input filenamed \"Code.txt\",
ID: 3614195 • Letter: Y
Question
you will create a simple program that reads in an input filenamed "Code.txt", reads words from that file (until EOF), and then"decodes" the message hidden in the input by saving every fifthword into a 2-dimensional character array (array of cstrings). Asyou read words from the file, print them to the screen as aparagraph (rather than one word per line, as found in the file).When all code words have been saved, print the decoded message tothe screen with an appropriate explanation (e.g. "Your decodedmessage says: ...." Finally, write the newly decodedmessage to an output file called "Message.txt."the file is: One
perspective
is
that
Computer
information
is
not
really
Science
There
are
not
even
444
types
of
processors.
This
is
a
strange
comment
on
the
overall
views
of
the
greatest
leaders
the
world's
elite
class
has
ever
known.
Not
ever!
you will create a simple program that reads in an input filenamed "Code.txt", reads words from that file (until EOF), and then"decodes" the message hidden in the input by saving every fifthword into a 2-dimensional character array (array of cstrings). Asyou read words from the file, print them to the screen as aparagraph (rather than one word per line, as found in the file).When all code words have been saved, print the decoded message tothe screen with an appropriate explanation (e.g. "Your decodedmessage says: ...." Finally, write the newly decodedmessage to an output file called "Message.txt."
the file is: One
perspective
is
that
Computer
information
is
not
really
Science
There
are
not
even
444
types
of
processors.
This
is
a
strange
comment
on
the
overall
views
of
the
greatest
leaders
the
world's
elite
class
has
ever
known.
Not
ever!
Explanation / Answer
please rate - thanks #include #include #include int main() {char word[20]; char save[50][20]; FILE *in, *out; int i=0,count=0,j; in = fopen("code.txt","r"); if(in == NULL) {printf("Error openinginput file! "); getch(); exit(1); } out = fopen("message.txt","w"); if(in == NULL) {printf("Error openingoutput file! "); getch(); exit(1); } while (fscanf(in, "%s", &word) != EOF) {printf("%s ",word); i++; if(i%10==0) printf(" "); if(i%5==0) {j=0; do {save[count][j]=word[j]; }while(save[count][j++]!=''); count++; } } printf(" Your decoded message says: "); for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.