'N' .AND. EOPTIGROG102 PASGROG133 INTRGROG133 PAS\ GROG135 INTUGROG135 PASINTRO02BINTIINTRO02BPASINTRO03AINTLINTRO03APASINTRO03BINTOINTRO03BPASINTRO06AINT_INTRO06APASINTRO06DINT[INTRO06DPASJRT17 INTJRT17 PASiJRT21 INTJRT21 PASmJRT22 INTJRT22 PASoJRT23 INTJRT23 PASqJRT24A INTJRT24A PASsJRT24B INT2JRT24B PASJRT25 INT JRT25 PASu JRT28 INTJRT28 PAS~JRT29 INT5JRT29 PASJRT3 INTJRT3 PASeJRT30 INTJRT30 PASJRT37 INT8JRT37 PASJRT38 INTJRT38 PASJRT40 INT>JRT40 PASJRT44 INTJRT44 PASJRT51 INTJRT51 PASJRT54 INT!JRT54 PAS JRT68 INTCJRT68 PASJRT72 INT&JRT72 PASJRT81 INT(JRT81 PASJRT82 INT,JRT82 PASJRT98 INT/JRT98 PASJUG 001JPZ80 INTXPZ80 PASAe@@?P@Program Tonerows; const rowlength = 12; type tonevalues = 1 .. rowlengths; row = set of tonevalues; var seed,counter,cycles : integer; tone : tonevalues; sequence : row; function randomtone (var randval : integer) : tonevalues; begin randomtone := randval mod rowlength + 1; randval := (25173 * randval + 13849) mod 65536 end; (* randomtone *) begin read (cycles,seed); for counter := 1 to cycles do begin sequence := [ ] repeat tone := randomtone (seed); if not (tone in sequence) then begin write (tone); sequence := sequence + [tone] end until sequence = [1 .. rowlength]; writeln end (* for *) end. (* tonerows *) {Program 0.1 assuming annual inflation rates of 7, 8, and 10 per cent, find the factor by which the frank, dollar, pound sterling, mark, or guilder will have been devalued in 1, 2, ... n years.} Program inflation; const n = 10; var i : integer; w1, w2, w3 : real; begin i := 0; w1 := 1.0; w2 := 1.0; w3 := 1.0; repeat i := i + 1; w1 := w1 * 1.07; w2 := w2 * 1.08; w3 := w3 * 1.10; writeln( i, w1, w2, w3 ) until i = n end. MPZ3 0300P_ h$A%$A%$A%i $Ap% $A% $A%     R2Y{Program 3.1 example of constant definition part} Program convert; const addin = 32; mulby = 1.8; low = 0; high = 39; separator = ' __________'; var degree : low..high; begin writeln( separator ); for degree := low to high do begin write( degree, 'c', round( degree * mulby + addin ), 'f' ); if odd( degree ) then writeln end; writeln; writeln( separator ) end. MPZ17 y{0300}P_= __________ i h'`a=c $A =f R^h P#h = __________ i Y$X_{Program 4.1 the compound statement} Program beginend; var sum : integer; begin sum := 3 + 5; writeln( sum, -sum ) end. MPZ21 #%0300'+P_j Y{Program 4.2 computer h( n ) = 1 + 1/2 + 1/3 + ... + 1/n} Program egwhile; var n : integer; h : real; begin read( n ); write( n ); h := 0; while n > 0 do begin h := h + 1/n; n := n - 1 end; writeln( h ) end. MPZ22 WY0300[cP_iih%hRF i%iP i Y&D{Program 4.3 compute h( n ) = 1 + 1/2 + 1/3 + ... + 1/n} Program egrepeat; var n : integer; h : real; begin read( n ); write( n ); h := 0; repeat h := h + 1/n; n := n - 1 until n = 0; writeln( h ) end. MPZ23 TV0300X^P_iih% i%ihR i YA{Program 4.4 computer h( n ) = 1 + 1/2 + 1/3 + ... + 1/n} Program egfor; var i, n : integer; h : real; begin read( n ); write( n ); h := 0; for i := n downto 1 do h := h + 1/i; writeln( h ); end. MPZ24A RT0300V^P_ii h%iaA  i%P* i Y+?{Program 4.6 NOTE: Have patience with this one. I thought it was broke until I looked at the code carefully. It takes awhile. JRT took ten minutes,(I didn't use a stop watch) while Pascal/Z took 5 minutes. But JRT had more digit accuracy. computer 1 - 1/2 + 1/3 - ... + 1/9999 - 1/10000, 4 ways: 1) left to right, in succession 2) left to right, all pos and neg terms, then subtract 3) right to left in succession 4) right to left, all pos and neg terms, then subtract} Program summing; var s1, s2p, s2n, s3, s4p, s4n, lrp, lrn, rlp, rln : real; i : integer; begin s1 := 0; s2p := 0; s2n := 0; s3 := 0; s4p := 0; s4n := 0; for i := 1 to 5000 do begin lrp := 1/( 2 * i - 1 ); {pos terms, left to right} lrn := 1/( 2 * i ); {neg terms, left to right} rlp := 1/( 10001 - 2 * i ); {pos terms, right to left} rln := 1/( 10002 - 2 * i ); {neg terms, right to left} s1 := s1 + lrp - lrn; s2p := s2p + lrp; s2n := s2n + lrn; s3 := s3 + rlp - rln; s4p := s4p + rlp; s4n := s4n + rln; end; writeln( s1, s2p - s2n ); writeln( s3, s4p - s4n ) end. MPZ25  0300"*P_Xh%h%h%h%&h%.h%Vi`6ijVi%>ijV%Fi'jV%Ni'jV% 6 > % 6 % > % F N %&& F %.. N %P4   j  & . j Y5{Program 4.7 write roman numerals} Program roman; var x, y : integer; begin y := 1; repeat x := y; write( x, ' ' ); while x >= 1000 do begin write( 'm' ); x := x - 1000 end; if x >= 500 then begin write( 'd' ); x := x - 500 end; while x >= 100 do begin write( 'c' ); x := x - 100 end; if x >= 50 then begin write( 'l' ); x := x - 50 end; while x >= 10 do begin write( 'x' ); x := x - 10 end; if x >= 5 then begin write( 'v' ); x := x - 5 end; while x >= 1 do begin write( 'i' ); x := x - 1 end; writeln; y := 2 * y until y > 5000 end.  JRT PASCAL USERS GROUP This is the first disk full of Public Domain software from the JUG group. It is only intended as a aid for those who are just starting out in Pascal and in particular, JRT PASCAL. The JUG people are mixed in with the Pascal/Z group because of their common interest in the language of PASCAL. All of these programs run and are in SOURCE plus INT. To demonstrate that JRT can run standard Pascal I have included most of the programs out of the USER MANUAL AND REPORT written by DR.Wirth. All of the programs that have JRTxx.xxx are from that book. The only minor problems I had was the large number of reserve words JRT has, so I had to change some variable names. The other problem was SIN and EXP are externals. But those were very minor and easily found and corrected. The novice will find that these programs are simple. I could have made a comment file for each program but I wanted them to read the source to see just what the program is doing and how to interface with it. So look at the .PAS file first and understand just what is going on and then run the program. Once you known how to do that, modify the program so that there is user interaction with the program. Then it will not be necessary to read the source to see what is going on. Next, add bells and whistles to make the program fancy and useful. I want to give credit to Gerry Hewett, STAR RT., BOX 108, INYOKERN CA,93527 for his donation of most of the rest of the programs. He is learning Pascal and has taken the trouble to debug and run programs out of his text books. The same approach should be used with his programs as you do with DR.Wirth's. We want to encourage all of you beginners to write, write programs. The only way to learn a language is to look at examples and write. Once written, send them to us and we will spread them around for others to use. It is not necessary to re-invent the wheel. For my part, I will be debugging Pascal/Z programs so they can be converted to JRT. In that way, we will get some advanced examples of software in a hurry. Send donations, articles, or information to: Z/JRT PASCAL USERS 7962 Center Parkway Sacramento, Ca 95823 Thank you - Charlie Foster Program Tonerows; const rowlength = 12; type tonevalues = 1 .. rowlengths; row = set of tonevalues; var seed,counter,cycles : integer; tone : tonevalues; sequence : row; function randomtone (var randval : integer) : tonevalues; begin randomtone := randval mod rowlength + 1; randval := (25173 * randval + 13849) mod 65536 end; (* randomtone *) begin read (cycles,seed); for counter := 1 to cycles do begin sequence := [ ] repeat tone := randomtone (seed); if not (tone in sequence) then begin write (tone); sequence := sequence + [tone] end until sequence = [1 .. rowlength]; writeln end (* for *) end. (* tonerows *) {Program 0.1 assuming annual inflation rates of 7, 8, and 10 per cent, find the factor by which the frank, dollar, pound sterling, mark, or guilder will have been devalued in 1, 2, ... n years.} Program inflation; const n = 10; var i : integer; w1, w2, w3 : real; begin i := 0; w1 := 1.0; w2 := 1.0; w3 := 1.0; repeat i := i + 1; w1 := w1 * 1.07; w2 := w2 * 1.08; w3 := w3 * 1.10; writeln( i, w1, w2, w3 ) until i = n end. {Program 3.1 example of constant definition part} Program convert; const addin = 32; mulby = 1.8; low = 0; high = 39; separator = ' __________'; var degree : low..high; begin writeln( separator ); for degree := low to high do begin write( degree, 'c', round( degree * mulby + addin ), 'f' ); if odd( degree ) then writeln end; writeln; writeln( separator ) end. {Program 4.1 the compound statement} Program beginend; var sum : integer; begin sum := 3 + 5; writeln( sum, -sum ) end. {Program 4.2 computer h( n ) = 1 + 1/2 + 1/3 + ... + 1/n} Program egwhile; var n : integer; h : real; begin read( n ); write( n ); h := 0; while n > 0 do begin h := h + 1/n; n := n - 1 end; writeln( h ) end. {Program 4.3 compute h( n ) = 1 + 1/2 + 1/3 + ... + 1/n} Program egrepeat; var n : integer; h : real; begin read( n ); write( n ); h := 0; repeat h := h + 1/n; n := n - 1 until n = 0; writeln( h ) end. {Program 4.4 computer h( n ) = 1 + 1/2 + 1/3 + ... + 1/n} Program egfor; var i, n : integer; h : real; begin read( n ); write( n ); h := 0; for i := n downto 1 do h := h + 1/i; writeln( h ); end. {Program 4.6 NOTE: Have patience with this one. I thought it was broke until I looked at the code carefully. It takes awhile. JRT took ten minutes,(I didn't use a stop watch) while Pascal/Z took 5 minutes. But JRT had more digit accuracy. computer 1 - 1/2 + 1/3 - ... + 1/9999 - 1/10000, 4 ways: 1) left to right, in succession 2) left to right, all pos and neg terms, then subtract 3) right to left in succession 4) right to left, all pos and neg terms, then subtract} Program summing; var s1, s2p, s2n, s3, s4p, s4n, lrp, lrn, rlp, rln : real; i : integer; begin s1 := 0; s2p := 0; s2n := 0; s3 := 0; s4p := 0; s4n := 0; for i := 1 to 5000 do begin lrp := 1/( 2 * i - 1 ); {pos terms, left to right} lrn := 1/( 2 * i ); {neg terms, left to right} rlp := 1/( 10001 - 2 * i ); {pos terms, right to left} rln := 1/( 10002 - 2 * i ); {neg terms, right to left} s1 := s1 + lrp - lrn; s2p := s2p + lrp; s2n := s2n + lrn; s3 := s3 + rlp - rln; s4p := s4p + rlp; s4n := s4n + rln; end; writeln( s1, s2p - s2n ); writeln( s3, s4p - s4n ) end. {Program 4.7 write roman numerals} Program roman; var x, y : integer; begin y := 1; repeat x := y; write( x, ' ' ); while x >= 1000 do begin write( 'm' ); x := x - 1000 end; if x >= 500 then begin write( 'd' ); x := x - 500 end; while x >= 100 do begin write( 'c' ); x := x - 100 end; if x >= 50 then begin write( 'l' ); x := x - 50 end; while x >= 10 do begin write( 'x' ); x := x - 10 end; if x >= 5 then begin write( 'v' ); x := x - 5 end; while x >= 1 do begin write( 'i' ); x := x - 1 end; writeln; y := 2 * y until y > 5000 end. {Program 4.9 graphic representation of a function f( x ) = exp( -x ) * sin( 2 * pi * x ) } Program graph1; const d = 0.0625; {1/16, 16 lines for interval [x, x + 1]} s = 32; {32 character widths for interval [y, y + 1]} h = 34; {character position of x-axis} c = 6.28318; {2 * pi} lim = 32; var x, y : real; i, n : integer; function exp ( x : real ): real; extern; function sin ( x : real ): real; extern; begin for i := 0 to lim do begin x := d * i; y := exp( -x ) * sin( c * x ); n := round( s * y ) + h; repeat write( ' ' ); n := n - 1; until n = 0; writeln( '*' ) end end. {Program 6.2; extend program 4.9 to print x-axis} Program graph2; const d = 0.0625; {1/16, 16 lines for interval [x, x + 1]} s = 32; {32 character widths for interval [y, y + 1]} h1 = 34; {character position of x-axis} h2 = 68; {line width} c = 6.28318; {2 * pi} lim = 32; var i, j, k, n : integer; x, y : real; a : array[ 1..h2 ] of char; function exp ( x : real ): real; extern; function sin ( x : real ): real; extern; begin for j := 1 to h2 do a[ j ] := ' '; for i := 0 to lim do begin x := d * i; y := exp( -x ) * sin( c * x ); a[ h1 ] := ':'; n := round( s*y ) + h1; a[ n ] := '*'; if n < h1 then k := h1 else k := n; for j := 1 to k do write ( a[ j ] ); writeln; a[ n ] := ' ' end end. {Program 8.1 example of set operations, NOTE: free is a reserved work in JRT so I changed it to freee} PROGRAM setop; TYPE days = ( m, t, w, th, fr, sa, su ); week = SET of days; VAR wk, work, freee : week; d : days; procedure check( s : week ); {procedures introduced in Chapter 11} var d : days; begin write( ' ' ); for d := m to su do if d in s then write( 'x' ) else write ( 'o' ); writeln end; {check} begin work := []; freee := []; wk := [ m..su ]; d := sa; freee := [ d ] + freee + [ su ]; check( freee ); work := wk - freee; check( work ); if freee <= wk then write( ' o' ); if wk >= work then write( 'k' ); if not( work >= freee ) then write( ' jack' ); if [ sa ] <= work then write( 'forget it' ); writeln end. {Program 7.1 operations on complex numbers} Program complex; { * ( output ) is implicit in Pascal/Z * } const fac = 4; type complex = record re, im : integer end; var x, y : complex; n : integer; begin x.re := 2; x.im := 7; y.re := 6; y.im := 3; for n := 1 to 4 do begin writeln( 'x = ',x.re : 3, x.im : 3, ' y = ', y.re : 3, y.im : 3); {x + y} writeln( 'sum = ', x.re + y.re : 3, x.im + y.im : 3); {x * y} writeln( 'product = ', x.re * y.re - x.im * y.im : 3, x.re * y.im + x.im * y.re : 3); writeln; x.re := x.re + fac; x.im := x.im - fac; end end. {Program 8.2 generate the primes between 3..10000 using a sieve containing odd integers in this range.} Program primes; { * ( output ) is implicit in Pascal/Z * } const wdlength = 59; {implementation dependent} maxbit = 58; w = 84; {w = n div wdlength div 2} var sieve, primes : array[ 0..w ] of set of 0..maxbit; next : record word, bit : integer end; j, k, t, c : integer; empty : boolean; begin {initialize} for t := 0 to w do begin sieve[ t ] := [ 0..maxbit ]; primes[ t ]:=[] end; sieve[ 0 ] := sieve[ 0 ]-[ 0 ]; next.word := 0; next.bit := 1; empty := false; with next do repeat {find next prime} while not( bit in sieve[ word ] ) do bit := succ( bit ); primes[ word ] := primes[ word ] + [ bit ]; c := 2 * bit + 1; { * display primes--the J&W version had no * } { * output statement * } {*} writeln( c + word * wdlength * 2 ); j := bit; k := word; while k <= w do {eliminate} begin sieve[ k ] := sieve[ k ] - [ j ]; k := k + word * 2; j := j + c; while j > maxbit do begin k := k + 1; j :=j - wdlength; end end; if sieve[ word ] = [] then begin empty := true; bit := 0; end; while empty and ( word < w ) do begin word := word + 1; empty := sieve[ word ] = [] end until empty; {ends with} end. {Program 11.3 procedure parameters} Program parameters; { * ( output ) is implicit in Pascal/Z * } var a, b : integer; procedure h( x : integer; var y : integer ); begin x := x + 1; y := y + 1; writeln( x, y ) end; begin a := 0; b := 0; h( a, b ); writeln( a, b ) end. {Program 11.8 extend program 4.8} Program expon2; { * ( output ) is implicit in Pascal/Z * } var pi, spi : real; function power( x : real; y : integer ) : real; {y >= 0} var z : real; begin z := 1; while y > 0 do begin while not odd( y ) do begin y := y div 2; x := sqr( x ) end; y := y - 1; z := x * z end; power := z end; {power} begin pi := 3.14159; writeln( 2.0, 7, power( 2.0, 7 ) ); spi := power( pi, 2 ); writeln( pi, 2, spi ); writeln( spi, 2, power( spi, 2 ) ); writeln( pi, 4, power( pi, 4 ) ) end. {Program 11.9 recursive formulation of god} Program recursivegod; { * ( output ) is implicit in Pascal/Z * } var x, y, n : integer; function god( m, n : integer ) : integer; begin if n = 0 then god := m else god := god( n, m mod n ) end; {god} procedure try( a, b : integer ); begin writeln( a, b, god( a, b ) ) end; begin try( 18, 27 ); try( 312, 2142 ); try( 61, 53 ); try( 98, 868 ) end. {Program 13.1 alfa values} Program egalfa; { * The type alfa is pre-defined by: * } { * type alfa = packed array[ 1..10 ] of char; * } { * * } { *Since Pascal/Z does not have the pre-defined type * } { *alfa, and all arrays in Pascal/Z are packed implicitly, * } { *alfa must be re-defined as below * } {*}type alfa = array[ 1..10 ] of char; var n1, n2 : alfa; begin write( 'names : ' ); n1 := 'raymond '; n2 := 'debby '; if n2 < n1 then writeln( n2, n1 ) else writeln( n1, n2 ) end. {Program 4.8 exponentiation with natural exponent} Program exponentiation; var e, y : integer; u, x, z : real; begin read( x, y ); write( x, y ); z := 1; u := x; e := y; while e > 0 do begin {z * u**e=x**y, e > 0} while not odd( e ) do begin e := e div 2; u := sqr( u ); end; e := e-1; z := u * z end; writeln( z ) {z = x**y} end. {Program 4.5 compute the cosine using the expansion: cos( x ) = 1 - x**2/( 2 * 1 ) + x**4/( 4 * 3 * 2 * 1 ) - ...} Program cosine; { * ( input, output ) is implicit in Pascal/Z * } const eps = 1.0E-14; var x, sx, s, t : real; i, k, n : integer; begin for i := 1 to n do begin read( x ); t := 1; k := 0; s := 1; sx := sqr( x ); while abs( t ) > eps * abs( s ) do begin k := k + 2; t := -t * sx/( k * ( k-1 ) ); s := s + t end; writeln( x, s, k div 2 ) end end. {Program 6.1 find the largest and smallest number in a given list} Program minmax; const n = 20; var i, u, v, min, max : integer; a : array[ 1..n ] of integer; {assume that at this point in the program, array a contains the values 35 68 94 7 88 -5 -3 12 35 9 -6 3 0 -2 74 88 52 43 5 4} begin {for ease of testing, I will fill the array for you} a[1]:=35;a[2]:=68;a[3]:=94;a[4]:=7;a[5]:=88;a[6]:=-5; a[7]:=-3;a[8]:=12;a[9]:=35;a[10]:=9;a[11]:=-6;a[12]:=3; a[13]:=0;a[14]:=-2;a[15]:=74;a[16]:=88;a[17]:=52;a[18]:=43; a[19]:=5;a[20]:=4; min := a[ 1 ]; max := min; i := 2; while i < n do begin u := a[ i ]; v := a[ i + 1 ]; if u > v then begin if u > max then max := u; if v < min then min := v; end else begin if v > max then max := v; if u < min then min := u; end; i := i + 2 end; if i = n then if a[ n ] > max then max := a[ n ] else if a[ n ] < min then min := a[ n ]; writeln( max, min ) end. {Program 6.3 matrix multiplication} program matrixmul; const m = 4; p = 3; n = 2; var i : 1..m; j : 1..n; k : 1..p; s : integer; a : array[ 1..m, 1..p ] of integer; b : array[ 1..p, 1..n ] of integer; c : array[ 1..m, 1..n ] of integer; begin for i := 1 to m do { assign initial values to a and b } begin for k := 1 to p do begin read( s ); write( s ); a[ i,k ] := s; end; writeln end; writeln; for k := 1 to p do begin for j := 1 to n do begin { * read s from data file * } read( s ); write( s ); b[ k,j ] := s; end; writeln end; writeln; {multiply a * b} for i := 1 to m do begin for j := 1 to n do begin s := 0; for k := 1 to p do s := s + a[ i, k ] * b[ k, j ]; c[ i, j ] := s; write( s ) end; writeln end; writeln end. {Program 11.1 extend program 6.1} Program minmax2; const n = 20; var a : array[ 1..n ] of integer; i, j : integer; procedure minmax; var i : 1..n; u, v, min, max : integer; begin min := a[ 1 ]; max := min; i := 2; while i < n do begin u := a[ i ]; v := a[ i + 1 ]; if u > v then begin if u > max then max := u; if v < min then min := v; end else begin if v > max then max := v; if u < min then min := u; end; i := i + 2; end; if i = n then if a[ n ] > max then max := a[ n ] else if a[ n ] < min then min := a[ n ]; writeln( min, max ); writeln end; {minmax} begin for i := 1 to n do begin read( a[ i ] ); write( a[ i ] : 3 ); end; writeln; minmax; for i := 1 to n do begin read( j ); a[ i ] := a[ i ] + j; write( a[ i ] :3 ); end; writeln; minmax end. Program Hanoi; var total : integer; procedure movetower (height,fromneedle,toneedle,useneedle : integer); procedure movedisk (takeoff,puton : integer); begin writeln(takeoff:2,' > ',puton:2) end; (* movedisk *) begin if height > 0 then begin movetower(height-1,fromneedle,useneedle,toneedle); movedisk(fromneedle,toneedle); movetower(height-1,useneedle,toneedle,fromneedle) end; end; begin (* main program *) writeln('How many discs?');writeln; read (total); movetower (total,1,3,2) end. (* This is Example 2b, page 8, of Pract Intr to Pascal *) (* Calculate car running costs. *) program ex2b; const roadtax = 50.0; var garage_bill, insurance, total : real; begin writeln('Enter repair cost:'); (* Note prettyfying *) read(garage_bill); writeln('Enter insurance charge:'); read(insurance); total := garage_bill + insurance + roadtax; writeln;writeln('Total cost of operation is ',total:6) end. (* This is Example 3A, page 10, PItP: *) program ex3a; var sum,number : integer; begin writeln('Input numbers to be added: 0 ends input.'); sum := 0; (* Clear to start *) repeat read(number); sum := sum + number until number = 0; writeln('The total is: ',sum) end. (* This is Example 3B, page 11, of PItP. *) program ex3b; var a,b,product : real; power : integer; begin writeln('Input the boundary number:'); read(a); writeln('Input the number to be exponentiated:'); read(b); power := 0; product := b; while product <= a do begin power := power + 1; product := product * b end; writeln('The largest power of ',b,' < ' ,a,' is ',power) end. Program Selections; const capacity = 20; type counter = 0 .. capacity; object = 1 .. capacity; container = set of object; var numballs,samplesize : counter; Procedure select (bag : container; sample,drawn : counter); var ball : object; begin if drawn < sample then for ball := 1 to capacity do if ball in bag then begin writeln(ball : 3 * drawn); select (bag - [ball],sample,drawn + 1) end end; (* select *) begin read(numballs,samplesize); if numballs => samplesize then select ([1 .. numballs] ,samplesize,0) else writeln('Invalid data') end. (* selections *) {Program 11.7 test side effect} Program sideffect; { * (output ) is implicit in Pascal/Z * } var a, z : integer; function sneaky( x : integer ) : integer; begin z := z - x; {side effect on z} sneaky := sqr( x ); end; { * sneaky * } begin z := 10; a := sneaky( z ); writeln( a, z ); z := 10; a := sneaky( 10 ) * sneaky( z ); writeln( a, z ); z := 10; a := sneaky( z ) * sneaky( 10 ); writeln( a, z ); end. (* This is Example 6D, page 42, of PItP: the use of procedures, variable parameters, and all that good stuff. NOTE: Since 1760 * 36 is too damned big for PascalZ as implemented on my computer, the MILES conversion has been dropped. *) program ex6d; var a,b,c,d,number : integer; procedure convert (var m,y,f,i,ins : integer); begin y := ins div 36; ins := ins mod 36; f := ins div 12; i := ins mod 12 end; begin repeat writeln('Input a value (inches) to be converted:'); read (number); convert (a,b,c,d,number); writeln ('This number of inches equals'); writeln(b:4, ' Yards '); writeln(c:1, ' Feet and '); writeln(d:2, ' inches.'); until number = 0 end.(* This is Example 6A, pagec38 of PItP: procedures. *) program ex6a; var num1,num2,total : real; procedure drawaline; const line = 10; var i : integer; begin for i := 1 to line do write ('-'); writeln end; begin writeln('Input two values separated by a space:'); read(num1,num2); writeln (num1:10:3); writeln (num2:10:3); drawaline; total := num1 + num2; writeln(total:10:3); drawaline end. MPZ3 0300P_ h$A%$A%$A%i $Ap% $A% $A%     R2YMPZ17 y{0300}P_= __________ i h'`a=c $A =f R^h P#h = __________ i Y$X_MPZ21 #%0300'+P_j YMPZ22 WY0300[cP_iih%hRF i%iP i Y&DMPZ23 TV0300X^P_iih% i%ihR i YAMPZ24A RT0300V^P_ii h%iaA  i%P* i Y+?MPZ25  0300"*P_Xh%h%h%h%&h%.h%Vi`6ijVi%>ijV%Fi'jV%Ni'jV% 6 > % 6 % > % F N %&& F %.. N %P4   j  & . j Y5MPZ28 $&0300(DP_ i=  jRE=m iP"Re=d idR=c idPe2R=l i2 R=x i PR=v iiR =i iiPh jR Y+CNn!MPZ30 0300P_h `$?bP%_ Z_$Ab Z%  "=  iihRd=* i PYEXP SIN ~MPZ38 103003QPID_biD`3 = 5Ph `$?bP%_ Z_$Ab Z%" =:5   "  =*5 "R "P  i ` 0 iPh   = 5P=YEXP SIN (1>MPZ51 0300-PHP_=  ih`C@R7=x iP@=o iPh Y_8NE&NEhINE6&6N&@NE&@X@&@E@X&@@OR= o i@@MR=k i@&@MR= jack iN@OR = forget it ih Y)5AMPZ44  0300"*P_j  i`=x =  = y =     =sum =     = product =       h P0Y1MPZ54 0300PIT_  hT`D  h:INEV  NEPh h @hNE h i h     @R  PqV  V  @ NE j i  ;ji      TR^    @ NE   j    :R[  i  ;P7P  @NJR} i h  TR  i   @NJP} RqY(;BIP@Y\fnMPZ72 ]_0300aiP1P_iij Y_ hhXj YJMPZ81 5703009OPZP_i%hRQR7j )%Pi  %P %Y_$A1AY%$A _$A  X _ j X% j   j_ j X  _  X Y5O$MPZ82 0300PfP_hRP8_XYP<__X Y_ X<8^X<=5X<bdX<Y5:[tMPZ98 0300PI _=names :  i= raymond 5 = debby 5 0 0 Rn0  0  j P0  0  j YUlMPZ24B 0300P_,&i*`ii%(hi% )% $3 ЛR((j  ((i%  %P8  (j PYNMPZ29 0300P_"j ji%  %hRRhj  )%PIi  %P@ i YGOfMPZ37 "$0300&xPI_8i #j D ^  X     #     h j J X 4 +   i  jR  i  RRw  R  P R  R jP,R R P  R   j Y#0=JWes 5BSam MPZ40 ]_0300aP?IIIIII_Bi` i` i i   PYh PLh  i`ij` i i&   Ph Ph i`Xij`Q h i`1    &  P2 ,  iPh Ph YMZ{(/=OVMPZ68 0300P)IP_ i  jR  i  RRz  R  P R  R jP/R R P  R   j h Y_2.i``. i. iP6h hX.i`0i. . 0. iPsh hXY8EVdp7AQ^gtMINTRO02B0300P_=Enter repair cost: i i=Enter insurance charge: i i  $BP%h =Total cost of operation is   j YMINTRO03Awy0300{P_ =(Input numbers to be added: 0 ends input. i hihR;=The total is:  j YXMINTRO03B0300P_ =Input the boundary number: i i=%Input the number to be exponentiated: i ih %  Ri  %Pt=The largest power of   = <   = is   Y~MGROG133 0300P-P_ iUb6hY_ ji `NE _jX @R i@ NE@i INJRSh PIYJ_mMGROG135 {}0300PaP_R`i``@R]i @NiXPY_ jRzY ,[^xMPZ80 0300P!P_Y_  _jXj  _ jX_jXj  _jX_ jXj Y8^jMINTRO06D  0300 PBP_$$  Y_='Input a value (inches) to be converted: i i   X=This number of inches equals i = Yards  j  i= Feet and  j  j= inches. j hREYMINTRO06A0300P'P_i `"=- iPh Y_=&Input two values separated by a space: i j  i   i hX  %  i hXY