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