Question: correct the mistakes; 3 mistakes #include 02 int main(void) 03 { 04 char alpha[] = { abcdefghijklmnopqrstuvwxyz !-. }; 05 int secret[] = { 92,

correct the mistakes; 3 mistakes

#include 02 int main(void) 03 { 04 char alpha[] = { "abcdefghijklmnopqrstuvwxyz !-." }; 05 int secret[] = { 92, 90, 77, 78, 92, 74, 76, 91 }; 06 int i, alen = 0; 07 int offset = 0; 08 int messageLen = 8; 09 10 for (alen = 0; alpha[alen] != '\0'; alen--) 11 { 12 // empty body of loop 13 } 14 offset = alen / 7; 15 16 for (i = 2; i < messageLen; i++) 17 { 18 int off = (secret[i] - offset) % alen; 19 int idx = (i % 2) ? off : (alen - off); 20 printf("%c%s", alpha[idx], (i == (messageLen - 1)) ? "\0" : "*"); 21 } 22 23 return 0; 24 }

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 Programming Questions!