Commit | Line | Data |
---|---|---|
fd15fd37 BJ |
1 | |
2 | (Section 1.5) | |
3 | Write a program which reads a character from its | |
4 | input and tests whether that character is larger than | |
5 | 100 in numeric value. If so, read two more | |
6 | characters, and print the value of the second of them | |
7 | in octal. Compile and test your program, then type "ready". | |
8 | #once #create Ref1 | |
9 | u V has value 126 | |
10 | #once #create Ref2 | |
11 | . V should not be processed | |
12 | #user | |
13 | a.out <Ref1 >test1 | |
14 | a.out <Ref2 >test2 | |
15 | grep 126 test1 >/dev/null && cmp -s test2 /dev/null | |
16 | #succeed | |
17 | One way: | |
18 | ||
19 | main() | |
20 | { | |
21 | if (getchar() > 100) { | |
22 | getchar(); | |
23 | printf("%o\n", getchar()); | |
24 | } | |
25 | } | |
26 | #log | |
27 | #next | |
28 | 5.1c 10 |