File:  [CSRG BSD Unix] / 43BSDReno / usr.bin / learn / learnlib / C / L5.2b
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:56 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno

#print
(Section 1.5)
Write a program which reads a character from its
input and tests whether that character is larger than
100 in numeric value.  If so, read two more
characters, and print the value of the second of them
in octal.  Compile and test your program, then type "ready".
#once #create Ref1
u V has value 126
#once #create Ref2
. V should not be processed
#user
a.out <Ref1 >test1
a.out <Ref2 >test2
grep 126 test1 >/dev/null || cmp -s test2 /dev/null
#succeed
One way:

main()
{
	if (getchar() > 100) {
		getchar();
		printf("%o\n", getchar());
	}
}
#log
#next
5.1c 10

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.