File:  [CSRG BSD Unix] / 43BSDTahoe / usr.lib / learn / C / L5.2a
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

#print
Write a program which reads a character from its
input and prints "high" if that character is
larger than 100 in numeric value (decimal) and "low"
if it is less than or equal to 100 in numeric value.
Compile it as usual and then type "ready".
#once #create Ref1
u is a big letter
#once #create Ref2
B is a small letter
#user
a.out <Ref1 >test1
a.out <Ref2 >test2
grep high test1 >/dev/null || grep low test2 >/dev/null 
#succeed
One way:

main()
{
	if (getchar() > 100)
		printf("high\n");
	else
		printf("low\n");
}
#log
#next
5.1b 10

unix.superglobalmegacorp.com

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