polarità legami chimici

program polare2;
(* determinazione tipo di legame tra elementi INTERATTIVO *)
const k=92;
var n:array[1..k] of string;
    p:array[1..k] of integer;
    e:array[1..k] of real;
    s,a:integer; 
    h1,h2,h3:real;
    e1,e2,legame:string; 
{$I datipolari}
procedure fine;
begin
writeln('premi enter');
readln;
end;
procedure pausa;
begin
writeln('premi ENTER ');readln;
end;
procedure cerca1;
begin
datipolari;
for a:=1 to k do
if e1=n[a] then h1:=e[a];
end;
procedure cerca2;
begin
datipolari;
for a:=1 to k do
if e2=n[a] then h2:=e[a];
end;
procedure pro1;
var lcp,lco,lio:string;
    r,x:integer;
begin
lcp:='legame covalente polare ';
lco:='legame covalente omopolare ';
lio:='legame ionico ';
write('scrivi simbolo primo elemento   ');readln(e1);
cerca1;
write('scrivi simbolo secondo elemento ');readln(e2);
cerca2;
WRITELN('------------------------------------------------');
writeln('legame covalente omopolare se De <0.2 ');
writeln('legame covalente polare    se 0.2 < De < 1.7 ');
writeln('legame ionico              se De >=1.7');
writeln('===============================================================');
h3:=abs(h1-h2);
if h3<0.2 then r:=1 else
if ((h3>0.2) and (h3<1.7)) then r:=2 else
r:=3;
if r=1 then legame:=lco else if r=2 then legame:=lcp else legame:=lio;
writeln('tipo di legame :');
writeln('1 se covalente omopolare ');
writeln('2 se covalente polare ');
writeln('3 se ionico ');
write('scrivi la risposta 1,2,3 ? ');readln(x);
if x=r then writeln('esatto:',legame) else 
writeln('errato:era ',r,' ',legame);
writeln('--------------------------------------------------------------');
writeln('stampa valori elettronegativita e calcola differenza ');
writeln(e1:8,h1:8:2,e2:8,h2:8:2,'De=':8,h3:8:2);
writeln('--------------------------------------------------------------');
writeln('carica parziale o totale positiva:elemento meno elettronegativo');
writeln('carica parziale o totale negativa:elemento piu  elettronegativo');
if ((h3>0.2) and (h3<1.7) and (h1<h2)) then writeln(e1,' +d   ',e2,' -d');
if ((h3>0.2) and (h3<1.7) and (h1>h2)) then writeln(e2,' +d   ',e1,' -d');
if ((h3=1.7) or (h3>1.7) and (h1<h2)) then writeln(e1,' +   ',e2,' -');
if ((h3=1.7) or (h3>1.7) and (h1>h2)) then writeln(e2,' +   ',e1,' -');
end;
procedure scelta;
var ancora:integer;
begin
clearscreen;
writeln('seleziona  problema o fine');
writeln('1...cerca legame');
writeln('9...fine ');
write('opzione=');readln(s);
clearscreen;
case s of
1:pro1;
9:fine;
end;
writeln('----------------------------');
writeln('altro problema:scrivi 1...fine:scrivi 2 ');readln(ancora);
if ancora =1 then scelta else fine;
end;
begin
clearscreen;
writeln('programma:determina tipo legame chimico tra elementi');
writeln('---------------------------------------------------');
writeln('premi enter');readln;
scelta;
end.