|
|
1.1 ! root 1: #print ! 2: Write a program which reads two numbers and ! 3: prints the larger one in decimal. Use the same ! 4: "getnum" subroutine. Compile, test and type ! 5: "ready" as usual. ! 6: #once #create Ref1 ! 7: 14039 89 ! 8: #once #create Ref2 ! 9: 20022 23001 ! 10: #once cp %s/getnum.o . ! 11: #user ! 12: a.out <Ref1 >x1 ! 13: a.out <Ref2 >x2 ! 14: grep 14039 x1 >/dev/null || grep 23001 x2 >/dev/null ! 15: #succeed ! 16: /* One way: */ ! 17: ! 18: main() { ! 19: int n1, n2; ! 20: ! 21: n1 = getnum(); ! 22: n2 = getnum(); ! 23: printf("%d\n", n1 > n2 ? n1 : n2); ! 24: } ! 25: ! 26: /* You could also use something like ! 27: ! 28: if (n1 > n2) ! 29: printf("%d\n", n1); ! 30: else ! 31: printf("%d\n", n2); ! 32: */ ! 33: #log ! 34: #next ! 35: 12.1b 10
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.