program between(input, output); (* between: compute whether a number is between two other numbers Dr. Thomas D. Schneider National Institutes of Health National Cancer Institute Center for Cancer Research Nanobiology Program Molecular Information Theory Group Frederick, Maryland 21702-1201 toms@ncifcrf.gov permanent email: toms@alum.mit.edu (use only if first address fails) http://www.ccrnp.ncifcrf.gov/~toms/ *) const (* begin module version *) version = 1.00; (* of between.p 2007 Apr 15 2007 Apr 15, 1.00: origin *) updateversion = 1.00; (* defines lowest acceptable current parameter file *) (* end module version *) (* begin module describe.between *) (* name between: compute whether a number is between two other numbers synopsis between(input: in, output: out) files input: three integers per line: a, b, c output: the character 't' if b is between (inclusive) a and c description Compute whether a number is between two other numbers. examples documentation see also author Thomas Dana Schneider bugs technical notes *) (* end module describe.between *) function dobetween(a,b,c: real): boolean; (* is b between a and c? *) (* this is an inclusive between *) begin dobetween:=((a<=b) and (b<=c)) or ((c<=b) and (b<=a)) end; (* begin module between.themain *) procedure themain(var input, bfile: text); (* the main procedure of the program *) var a, b, c: real; begin reset(input); while not eof(input) do begin readln(input, a,b,c); if dobetween(a,b,c) then writeln(output,'t') else writeln(output,'f'); end end; (* end module between.themain *) begin themain(input, output); end.