% From: leathrum@dartmouth.edu (Thomas E. Leathrum) % Newsgroups: comp.text.tex % Subject: Re: WEB % Date: 26 Feb 90 00:44:03 GMT % Organization: Dartmouth College, Hanover, NH % % I haven't been paying a whole lot of attention to the messages about % typesetting computer programs, but one I read had an interesting idea: reverse % the typefaces, leaving reserved words in plain face and putting variable and % procedure names in boldface instead. (The argument went something like this: % reserved words are a computer language's fancy idea of punctuation, and besides % not really as important as the variables and such, so why not turn things % around?) Well, I tried this idea out by typesetting a little procedure from % Jensen and Wirth's Pascal User Manual and Report, and I'm convinced -- it % really looks better! So, for your perusal, I enclose below a little plainTeX % file with a Pascal procedure to find and print the largest and smallest entries % in an array of n integers. % % Regards, % Tom Leathrum % moth@dartmouth.edu % % --------------------------------------- % % >From Program 11.1 p.68 in 2nd edition % \+ procedure {\bf minmax};\cr \+ var {\bf i}: 1..{\bf n};\cr \+ \quad {\bf u}, {\bf v}, {\bf min}, {\bf max}: integer;\cr \+ begin\cr \+ \quad {\bf min}$:=${\bf a}[1];\cr \+ \quad {\bf max}$:=${\bf min};\cr \+ \quad while {\bf i}$<${\bf n} do\cr \+ \quad begin\cr \+ \quad \quad {\bf u}$:=${\bf a}[{\bf i}];\cr \+ \quad \quad {\bf v}$:=${\bf a}[{\bf i}$+1$];\cr \+ \quad \quad if {\bf u}$>${\bf v} then\cr \+ \quad\quad begin\cr \+ \quad \quad\quad if {\bf u}$>${\bf max} then {\bf max}$:=${\bf u};\cr \+ \quad \quad\quad if {\bf v}$<${\bf min} then {\bf min}$:=${\bf u};\cr \+ \quad\quad end;\cr \+ \quad \quad else\cr \+ \quad\quad begin\cr \+ \quad \quad\quad if {\bf v}$>${\bf max} then {\bf max}$:=${\bf v};\cr \+ \quad \quad\quad if {\bf u}$<${\bf min} then {\bf min}$:=${\bf u};\cr \+ \quad\quad end;\cr \+ \quad \quad {\bf i}$:=${\bf i}$+2$;\cr \+ \quad end;\cr \+ \quad if {\bf i}$=${\bf n} then\cr \+ \quad \quad if {\bf a}[{\bf n}]$>${\bf max} then {\bf max}$:=${\bf a}[{\bf n}];\cr \+ \quad else\cr \+ \quad \quad if {\bf a}[{\bf n}]$<${\bf min} then {\bf min}$:=${\bf a}[{\bf n}];\cr \+ \quad {\bf writeln}({\bf min}, {\bf max});\cr \+ \quad {\bf writeln};\cr \+ end;\cr \end