Program gas1; (* esempi DIMOSTRATIVO problemi sui GAS *) uses crt; const r=0.082; VAR a:integer; procedure cancella; begin clrscr; end; procedure pausa; begin writeln('premi ENTER ');readln; end; procedure fine; begin writeln('fine operazione:confermare :premi enter'); readln; end; procedure pressione(gas:string;pm:integer); var p,v,t,g,hg:real; tk,tc:integer; begin writeln('calcolare la pressione in atmosfere e in mmHg '); writeln('del gas indicato,usando i dati assegnati:R = 0.082 '); writeln('formula generale PV=mRT/PM '); writeln('---------------------------------------------------------'); writeln(gas); writeln('---------------------------------------------------------'); v:=random*100; v:=abs(v); v:=round(v)+1; writeln('volume in litri ----------------=',v:0:0); t:=random*100; t:=abs(t); tc:=round(t)+1; tk:=tc+273; writeln('temperatura in gradi centigradi =',tc:0); g:=random*20; g:=abs(g); g:=round(g)+1; writeln('massa in grammi---------------- =',g:0:0); writeln('----------------------------------------------------------'); writeln('trasformo gradi centigradi in kelvin :K = 273 +C = ',tk:0); writeln('----------------------------------------------------------'); writeln('cerco peso molecolare del gas indicato :PM = ',pm); writeln('----------------------------------------------------------'); p:=(g*R*tk)/(pm*v); writeln('applico la formula P = m*R*T/PM*V = ',p:0:3); writeln('----------------------------------------------------------'); hg:=p*760; writeln('trasformo atmosfere in mmHg : Hg = atmosfere*760 = ',hg:0:3); writeln('----------------------------------------------------------'); pausa;cancella; end; procedure volume(gas:string;pm:integer); var p,v,t,g,hg,cc:real; tk,tc:integer; begin writeln('calcolare il volume in litri e in cc. '); writeln('del gas indicato,usando i dati assegnati:R = 0.082 '); writeln('formula generale PV=mRT/PM '); writeln('---------------------------------------------------------'); writeln(gas); writeln('---------------------------------------------------------'); p:=random*100; p:=abs(p); p:=round(p)+1; writeln('pressione in atmosfere ---------=',p:0:0); t:=random*100; t:=abs(t); tc:=round(t)+1; tk:=tc+273; writeln('temperatura in gradi centigradi =',tc:0); g:=random*20; g:=abs(g); g:=round(g)+1; writeln('massa in grammi---------------- =',g:0:0); writeln('----------------------------------------------------------'); writeln('trasformo gradi centigradi in kelvin :K = 273 +C = ',tk:0); writeln('----------------------------------------------------------'); writeln('cerco peso molecolare del gas indicato :PM = ',pm); writeln('----------------------------------------------------------'); v:=(g*R*tk)/(pm*p); writeln('applico la formula V = m*R*T/PM*P = ',v:0:3); writeln('----------------------------------------------------------'); cc:=v*1000; writeln('trasformo litri in cc : cc = litri*1000 = ',cc:0:3); writeln('----------------------------------------------------------'); pausa;cancella; end; procedure gradi(gas:string;pm:integer); var p,v,t,g,hg,tc:real; begin writeln('calcolare la TEMPERATURA in gradi centigradi e kelvin '); writeln('del gas indicato,usando i dati assegnati:R = 0.082 '); writeln('formula generale PV=mRT/PM '); writeln('---------------------------------------------------------'); writeln(gas); writeln('---------------------------------------------------------'); v:=random*100; v:=abs(v); v:=round(v)+1; writeln('volume in litri ----------------=',v:0:0); p:=random*100; p:=abs(p); p:=round(p)+1; writeln('pressione in atmosfere P -------=',p:0:3); g:=random*20; g:=abs(g); g:=round(g)+1; writeln('massa in grammi---------------- =',g:0:0); writeln('----------------------------------------------------------'); writeln('cerco peso molecolare del gas indicato :PM = ',pm); writeln('----------------------------------------------------------'); t:=(p*v*pm)/(R*g); tc:=t-273; writeln('applico la formula T = P*V*PM/R*m= ',t:0:3); writeln('----------------------------------------------------------'); writeln('trasformo gradi kelvin in centigradi :C = K - 273 = ',tc:0:3); writeln('----------------------------------------------------------'); pausa;cancella; end; procedure massa(gas:string;pm:integer); var p,v,t,g,hg,tc,kg,nmoli:real; begin writeln('calcolare la MASSA in grammi e Kg'); writeln('del gas indicato,usando i dati assegnati:R = 0.082 '); writeln('formula generale PV=mRT/PM '); writeln('---------------------------------------------------------'); writeln(gas); writeln('---------------------------------------------------------'); v:=random*100; v:=abs(v); v:=round(v)+1; writeln('volume in litri ----------------=',v:0:0); p:=random*100; p:=abs(p); p:=round(p)+1; writeln('pressione in atmosfere P -------=',p:0:3); t:=random*100; t:=abs(t); t:=round(t)+1; writeln('temperatura in kelvin---------- =',t:0:0); writeln('----------------------------------------------------------'); writeln('cerco peso molecolare del gas indicato :PM = ',pm); writeln('----------------------------------------------------------'); g:=(p*v*pm)/(R*t); kg:=g/1000; writeln('applico la formula grammi: m = P*V*PM/R*T= ',g:0:3); writeln('----------------------------------------------------------'); writeln('trasformo i grammi in Kg : Kg = grammi/1000 = ',kg:0:3); writeln('----------------------------------------------------------'); nmoli:=g/pm; writeln('calcolo numero di moli n = massa/PM = ',nmoli:0:3); writeln('----------------------------------------------------------'); pausa;cancella; end; procedure mole(gas:string;px:integer); var p,v,t,g,hg,tc,kg,pm:real; begin writeln('calcolare la PESO MOLECOLARE in grammi per mole'); writeln('del gas indicato,usando i dati assegnati:R = 0.082 '); writeln('formula generale PV=mRT/PM '); writeln('---------------------------------------------------------'); writeln(gas); writeln('---------------------------------------------------------'); v:=random*100; v:=abs(v); v:=round(v)+1; writeln('volume in litri ----------------=',v:0:0); p:=random*100; p:=abs(p); p:=round(p)+1; writeln('pressione in atmosfere P -------=',p:0:3); t:=random*100; t:=abs(t); t:=round(t)+1; writeln('temperatura in kelvin---------- =',t:0:0); g:=random*20; g:=abs(g); g:=round(g)+1; writeln('massa in grammi ---------- =',g:0:0); writeln('----------------------------------------------------------'); pm:=(g*R*t)/(p*v); writeln('applico la formula PM = m*R*T/P*V = ',pm:0:3); writeln('----------------------------------------------------------'); pausa;cancella; end; procedure pro1; begin pressione('idrogeno H2',2 );pressione('ossigeno O2',32); pressione('cloro Cl2',70);pressione('azoto N2',28); pressione('metano CH4',16);pressione('anidride carbonica CO2 ',44); end; procedure pro2; begin volume('idrogeno H2',2 );volume('ossigeno O2',32); volume('cloro Cl2',70);volume('azoto N2',28); volume('etilene C2H2',26);volume('anidride solforosa SO2 ',64); end; procedure pro3; begin gradi('idrogeno H2',2 );gradi('ossigeno O2',32); gradi('cloro Cl2',70);gradi('azoto N2',28); gradi('etilene C2H2',26);gradi('anidride solforosa SO2 ',64); end; procedure pro4; begin massa('idrogeno H2',2 );massa('ossigeno O2',32); massa('cloro Cl2',70);massa('azoto N2',28); massa('etilene C2H2',26);massa('anidride solforosa SO2 ',64); end; procedure pro5; begin mole('idrogeno H2',2 );mole('ossigeno O2',32); mole('cloro Cl2',70);mole('azoto N2',28); mole('etilene C2H2',26);mole('anidride solforosa SO2 ',64); end; procedure scelta; var s,sn:string;opzione:integer; begin cancella; writeln('seleziona opzione :'); writeln('1...calcolo PRESSIONE:dimostrativo'); writeln('2...calcolo VOLUME:dimostrativo'); writeln('3...calcolo TEMPERATURA:dimostrativo'); writeln('4...calcolo MASSA e numero MOLI:dimostrativo'); writeln('5...calcolo PESO MOLECOLARE:dimostrativo'); writeln('9...fine '); writeln('scelta =');readln(opzione);cancella; case opzione of 1:pro1;2:pro2;3:pro3;4:pro4;5:pro5; 9:fine; end; writeln('altra operazione?Esperimenti?:premi S...fine:premi N '); readln(sn); if ((sn='S') or (sn='s')) then scelta ; end; begin cancella; writeln('esempi risolti e commentati di problemi sui gas '); writeln('applicando la legge generale PV=nRT = gRT/PM '); writeln('e le formule derivate inverse '); writeln('terminato questo programma,attiva GAS2 per risolvere problemi'); pausa; scelta; end.