{ PROGRAM NAME:FLOWMETER.PAS AUTHOR: CHARLES D. WATHEN DATE: DECEMBER 22, 1989 } program FLOW; var A, B, C, D, E, F, G, H, I, J : real; CODE : integer; KEY : char; TEMP, VOL, SEC, BAR, H20 : string[10]; procedure RESET; begin A:=0; B:=0; C:=0; D:=0; E:=0; F:=0; G:=0; H:=0; I:=0; J:=0; CODE :=0; end; procedure TEMPERATURE; label OPPS; begin textbackground(1); textcolor(15); clrscr; gotoxy(13,24);write('Press CONTROL-BREAK or CONTROL-C To Terminate Program'); gotoxy(5,2);write('This program calculates the actual flow when calibrating Mass Flowmeters'); gotoxy(15,3);write('at zero degress C and 760mm of mercury.'); OPPS: textcolor(14); gotoxy(2,5);write('What is the AMBIENT TEMPERATURE in degress C ? '); readln(TEMP); val(TEMP,A,CODE); if (TEMP = '') or (CODE <> 0) then begin textcolor(12+16); sound(37); delay(500); nosound; gotoxy(15,20);write('YOU HAVE ENTERED A INCORRECT VALUE . . .'); textcolor(14); gotoxy(20,22);write('PRESS ANY KEY TO TRY AGAIN'); read(kbd,KEY); gotoxy(15,20);writeln(' '); gotoxy(49,5);write(' '); gotoxy(20,22);write(' '); A := 0; CODE := -1; goto OPPS; end else val(TEMP,A,CODE) end; procedure VOLUME; label OPPS; begin OPPS: gotoxy(2,7);write('What is DISTANCE that the bubble traveled (cc/min) ? '); readln(VOL); val(VOL,B,CODE); if (VOL = '') or (CODE <> 0) then begin textcolor(12+16); sound(37); delay(500); nosound; gotoxy(15,20);write('YOU HAVE ENTERED A INCORRECT VALUE . . .'); textcolor(14); gotoxy(20,22);write('PRESS ANY KEY TO TRY AGAIN'); read(kbd,KEY); gotoxy(15,20);writeln(' '); gotoxy(42,7);write(' '); gotoxy(20,22);write(' '); B := 0; CODE := -1; goto OPPS; end else val(VOL,B,CODE) end; procedure TIME; label OPPS; begin OPPS: gotoxy(2,9);write('What is the elapse TIME in seconds ? '); readln(SEC); val(SEC,C,CODE); if (SEC = '') or (CODE <> 0) then begin textcolor(12+16); sound(37); delay(500); nosound; gotoxy(15,20);write('YOU HAVE ENTERED A INCORRECT VALUE . . .'); textcolor(14); gotoxy(20,22);write('PRESS ANY KEY TO TRY AGAIN'); read(kbd,KEY); gotoxy(15,20);writeln(' '); gotoxy(39,9);write(' '); gotoxy(20,22);write(' '); C := 0; CODE := -1; goto OPPS; end else val(SEC,C,CODE) end; procedure BAROMETER; label OPPS; begin OPPS: gotoxy(2,11);write('What is the reading on the BAROMETER (mm) ? '); readln(BAR); val(BAR,D,CODE); if (BAR = '') or (CODE <> 0) then begin textcolor(12+16); sound(37); delay(500); nosound; gotoxy(15,20);write('YOU HAVE ENTERED A INCORRECT VALUE . . .'); textcolor(14); gotoxy(20,22);write('PRESS ANY KEY TO TRY AGAIN'); read(kbd,KEY); gotoxy(15,20);writeln(' '); gotoxy(41,11);write(' '); gotoxy(20,22);write(' '); D := 0; CODE := -1; goto OPPS; end else val(BAR,D,CODE) end; procedure WATER; label OPPS; begin OPPS: gotoxy(2,13);write('What is the VAPOR PRESSURE OF WATER for '); gotoxy(2,14);write('ambient temperature in degress C ? '); readln(H20); val(H20,E,CODE); if (H20 = '') or (CODE <> 0) then begin textcolor(12+16); sound(37); delay(500); nosound; gotoxy(15,20);write('YOU HAVE ENTERED A INCORRECT VALUE . . .'); textcolor(14); gotoxy(20,22);write('PRESS ANY KEY TO TRY AGAIN'); read(kbd,KEY); gotoxy(15,20);writeln(' '); gotoxy(37,14);write(' '); gotoxy(20,22);write(' '); E := 0; CODE := -1; goto OPPS; end else val(H20,E,CODE) end; procedure CALCULATE; begin F:= D * ((1 + 0.0000184 * (A)) / ( 1 + 0.0001818 * (A)) - 1); G:= F * (-1.029574447E-03); H:= D + F + G; I:= ((273.15 / (273.15 + A)) * (H - E) / 760) * (B * 60 / C); end; procedure ANSWER; begin textcolor(15); gotoxy(17,17);writeln('The ACTUAL FLOW is: ',I:0:10, ' cc/min'); gotoxy(13,24);write(' '); end; procedure AGAIN; begin textcolor(13); gotoxy(25,21);write('DO IT AGAIN [ Y / N ] ? '); read(kbd,KEY); KEY := upcase(KEY); if KEY = 'Y' then exit else halt end; label DOITAGAIN; begin DOITAGAIN: RESET; TEMPERATURE; VOLUME; TIME; BAROMETER; WATER; CALCULATE; ANSWER; AGAIN; goto DOITAGAIN; end.