/* mp1.c by Douglas W. Jones */ #include #include "/mnt/nfs/clasnetappvm/fs3/dwjones/2630mp1.h" int main() { int i = 0; int lastk = -1; /* this only matters if key[0] < -1 */ for (;;) { /* for each successive key entry */ int k = key[i]; if (k == -1) break; /* the only loop exit */ if (k >= 0) { /* positive keys */ putchar( text[k] ); /* produce one character */ lastk = k; } else { /* negative keys */ do { /* inner loop to produce string of characters */ k = k + 1; lastk = lastk + 1; putchar( text[lastk] ); } while (k < -1); } i = i + 1; /* move on to the next key */ } return 0; /* return value is ignored */ }