|
|
1.1 root 1: #print
2: Write a program that reads in lines, and prints each out
3: in reverse order (except that the newline should be
4: at the end).
5: Thus the line
6: cat food
7: should come out as
8: doof tac
9: Compile it and run it, then type "ready".
10: #once #create Ref1
11: This is odd.
12: This is even.
13:
14: #once #create Ref2
15: .ddo si sihT
16: .neve si sihT
17:
18: #once cp %s/getline.o .
19: #user
20: a.out <Ref1 >x1
21: #cmp x1 Ref2
22: #succeed
23: /* one way to do this */
24: #include <stdio.h>
25:
26: main()
27: {
28: char line[500];
29: int n;
30:
31: while ((n = getline(line, 500)) > 0) {
32: for (n -= 2; n >= 0; n--)
33: putchar(line[n]);
34: putchar('\n');
35: }
36: }
37: #log
38: #next
39: 17.1a 10
40: 16.2a 5
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.