Commit | Line | Data |
---|---|---|
cb8c26cc TL |
1 | |
2 | With your 'cc' command you can give the name of | |
3 | an object file to be loaded with your program. | |
4 | For example | |
5 | cc x.c y.o | |
6 | will load the previously compiled program 'y' along with | |
7 | the program 'x' to be compiled now. | |
8 | ||
9 | The file "getnum.o" contains a subroutine "getnum" which | |
10 | reads an integer and returns its value. | |
11 | Write a program which reads a number and decides | |
12 | whether or not it is a multiple of 23. If so print | |
13 | "yes" and otherwise print "no". | |
14 | Compile and test; then type "ready". | |
15 | #once #create Ref1 | |
16 | 23000 | |
17 | #once #create Ref2 | |
18 | 23001 | |
19 | #once cp %s/getnum.o . | |
20 | #user | |
21 | a.out <Ref1 >z1 | |
22 | a.out <Ref2 >z2 | |
23 | grep yes z1 >/dev/null && grep no z1 >/dev/null | |
24 | #succeed | |
25 | /* One way: */ | |
26 | ||
27 | main() { | |
28 | if (getnum()%23 == 0) | |
29 | printf("yes\n"); | |
30 | else | |
31 | printf("no\n"); | |
32 | } | |
33 | #log | |
34 | #next | |
35 | 12.1a 10 |