|
|
1.1 ! root 1: #print ! 2: Write a subroutine ! 3: errmess(n) ! 4: which looks at its argument and prints ! 5: one of the following messages: ! 6: n message (follow it by a newline) ! 7: 1 ? ! 8: 2 syntax error ! 9: 3 bad syntax error ! 10: 4 fatal error ! 11: 5 I give up. ! 12: anything else eh? ! 13: Leave the routine on errmess.c, compiled and tested ! 14: as usual. Then type "ready". ! 15: #once #create Ref ! 16: eh? ! 17: eh? ! 18: I give up. ! 19: fatal error ! 20: bad syntax error ! 21: syntax error ! 22: ? ! 23: #once #create tzaqc.c ! 24: main() ! 25: { ! 26: errmess (23069); ! 27: errmess (-2000); ! 28: errmess (5); ! 29: errmess (4); ! 30: errmess (3); ! 31: errmess (2); ! 32: errmess (1); ! 33: } ! 34: #user ! 35: cc tzaqc.c errmess.o ! 36: a.out >xxx ! 37: #cmp Ref xxx ! 38: #succeed ! 39: /* a possible solution */ ! 40: char *message[] = { ! 41: "eh?", ! 42: "?", ! 43: "syntax error", ! 44: "bad syntax error", ! 45: "fatal error", ! 46: "I give up.", ! 47: }; ! 48: errmess(n) ! 49: { ! 50: if (n < 0 || n > 5) ! 51: n = 0; ! 52: printf("%s\n", message[n]); ! 53: } ! 54: #log ! 55: #next ! 56: 41.1a 10
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.