program lega2; (* determinazione tipo di legame tra elementi DIMOSTRATIVO *) (* elementi e composti chimici IN FORMULE *) uses crt; const k=92; var n:array[1..k] of string; p:array[1..k] of integer; e:array[1..k] of real; fx:array[1..40] of string[15]; s,a,f,prove:integer; h1,h2,h3,h4:real; e1,e2,legame:string; procedure fine; begin writeln('premi enter'); readln; end; procedure pausa; begin writeln('premi ENTER ');readln; end; procedure cancella; begin clrscr; end; (* procedure formule; begin fx[1]:='Ba(OH)2';fx[2]:='Ca(NO3)2';fx[3]:='HCl';fx[4]:='HClO2'; fx[5]:='NaF';fx[6]:='H2SO4';fx[7]:='H2CO3';fx[8]:='HClO'; fx[9]:='NaNO3';fx[10]:='K2SO3';fx[11]:='ZnSO4';fx[12]:='HNO2'; fx[13]:='HClO4';fx[14]:='CaSO3';fx[15]:='KClO2';fx[16]:='CaCO3'; fx[17]:='BaSO4';fx[18]:='H2S';fx[19]:='SO3';fx[20]:='N2O5'; fx[20]:='KCl';fx[21]:='CaCl2';fx[22]:='KNO2';fx[23]:='KNO3';fx[24]:='BaCl2'; fx[25]:='KOH';fx[26]:='Ca(OH)2';fx[27]:='MgO';fx[28]:='Al(OH)3';fx[29]:='KF'; fx[30]:='N2O3';fx[31]:='H3PO4';fx[32]:='AlPO4';fx[33]:='NaOH';fx[34]:='SO3'; fx[35]:='CO2';fx[36]:='P2O3';fx[37]:='Ca(NO3)2';fx[38]:='Mg(OH)2'; fx[39]:='CaSO3'; fx[40]:='MgF2'; end;*) procedure datipo; begin n[1]:='H';p[1]:=1;e[1]:=2.1; n[2]:='He';p[2]:=4;e[2]:=0; n[3]:='Li';p[3]:=7;e[3]:=1; n[4]:='Be';p[4]:=9;e[4]:=1.5; n[5]:='B';p[5]:=11;e[5]:=2; n[6]:='C';p[6]:=12;e[6]:=2.5; n[7]:='N';p[7]:=14;e[7]:=3; n[8]:='O';p[8]:=16;e[8]:=3.5; n[9]:='F';p[9]:=19;e[9]:=4; n[10]:='Ne';p[10]:=20;e[10]:=0; n[11]:='Na';p[11]:=23;e[11]:=0.9; n[12]:='Mg';p[12]:=24;e[12]:=1.2; n[13]:='Al';p[13]:=27;e[13]:=1.5; n[14]:='Si';p[14]:=28;e[14]:=1.8; n[15]:='P';p[15]:=31;e[15]:=2.1; n[16]:='S';p[16]:=32;e[16]:=2.5; n[17]:='Cl';p[17]:=35;e[17]:=3; n[18]:='Ar';p[18]:=40;e[18]:=0; n[19]:='K';p[19]:=39;e[19]:=0.8; n[20]:='Ca';p[20]:=40;e[20]:=1; n[21]:='Sc';p[21]:=45;e[21]:=1.3; n[22]:='Ti';p[22]:=48;e[22]:=1.6; n[23]:='V';p[23]:=51;e[23]:=1.6; n[24]:='Cr';p[24]:=52;e[24]:=1.6; n[25]:='Mn';p[25]:=55;e[25]:=1.5; n[26]:='Fe';p[26]:=56;e[26]:=1.8; n[27]:='Co';p[27]:=59;e[27]:=1.8; n[28]:='Ni';p[28]:=59;e[28]:=1.8; n[29]:='Cu';p[29]:=64;e[29]:=1.9; n[30]:='Zn';p[30]:=65;e[30]:=1.6; n[31]:='Ga';p[31]:=70;e[31]:=1.6; n[32]:='Ge';p[32]:=73;e[32]:=1.8; n[33]:='As';p[33]:=75;e[33]:=2; n[34]:='Se';p[34]:=79;e[34]:=2.4; n[35]:='Br';p[35]:=80;e[35]:=2.8; n[36]:='Kr';p[36]:=84;e[36]:=0; n[37]:='Rb';p[37]:=85;e[37]:=0.8; n[38]:='Sr';p[38]:=88;e[38]:=1; n[39]:='Y';p[39]:=89;e[39]:=1.2; n[40]:='Zr';p[40]:=91;e[40]:=1.4; n[41]:='Nb';p[41]:=93;e[41]:=1.6; n[42]:='Mo';p[42]:=96;e[42]:=1.8; n[43]:='Tc';p[43]:=99;e[43]:=1.9; n[44]:='Ru';p[44]:=101;e[44]:=2.2; n[45]:='Rh';p[45]:=103;e[45]:=2.2; n[46]:='Pd';p[46]:=106;e[46]:=2.2; n[47]:='Ag';p[47]:=108;e[47]:=1.9; n[48]:='Cd';p[48]:=112;e[48]:=1.7; n[49]:='In';p[49]:=115;e[49]:=1.7; n[50]:='Sn';p[50]:=119;e[50]:=1.8; n[51]:='Sb';p[51]:=122;e[51]:=1.9; n[52]:='Te';p[52]:=128;e[52]:=2.1; n[53]:='I';p[53]:=127;e[53]:=2.5; n[54]:='Xe';p[54]:=131;e[54]:=0; n[55]:='Cs';p[55]:=133;e[55]:=0.7; n[56]:='Ba';p[56]:=137;e[56]:=0.9; n[57]:='La';p[57]:=139;e[57]:=1.1; n[58]:='Ce';p[58]:=140;e[58]:=1.1; n[59]:='Pr';p[59]:=141;e[59]:=1.1; n[60]:='Nd';p[60]:=144;e[60]:=1.2; n[61]:='Pm';p[61]:=145;e[61]:=1.2; n[62]:='Sm';p[62]:=150;e[62]:=1.2; n[63]:='Eu';p[63]:=152;e[63]:=1.2; n[64]:='Gd';p[64]:=157;e[64]:=1.1; n[65]:='Tb';p[65]:=159;e[65]:=1.2; n[66]:='Dy';p[66]:=162;e[66]:=1.2; n[67]:='Ho';p[67]:=165;e[67]:=1.2; n[68]:='Er';p[68]:=167;e[68]:=1.2; n[69]:='Tm';p[69]:=169;e[69]:=1.2; n[70]:='Yb';p[70]:=173;e[70]:=1.1; n[71]:='Lu';p[71]:=174;e[71]:=1.2; n[72]:='Hf';p[72]:=178;e[72]:=1.3; n[73]:='Ta';p[73]:=181;e[73]:=1.5; n[74]:='W';p[74]:=184;e[74]:=1.7; n[75]:='Re';p[75]:=186;e[75]:=1.9; n[76]:='Os';p[76]:=190;e[76]:=2.2; n[77]:='Ir';p[77]:=192;e[77]:=2.2; n[78]:='Pt';p[78]:=195;e[78]:=2.2; n[79]:='Au';p[79]:=197;e[79]:=2.4; n[80]:='Hg';p[80]:=201;e[80]:=1.9; n[81]:='Tl';p[81]:=204;e[81]:=1.8; n[82]:='Pb';p[82]:=207;e[82]:=1.8; n[83]:='Bi';p[83]:=209;e[83]:=1.9; n[84]:='Po';p[84]:=209;e[84]:=2; n[85]:='At';p[85]:=210;e[85]:=2.2; n[86]:='Rn';p[86]:=222;e[86]:=0; n[87]:='Fr';p[87]:=223;e[87]:=0.7; n[88]:='Ra';p[88]:=226;e[88]:=0.9; n[89]:='Ac';p[89]:=227;e[89]:=1.1; n[90]:='Th';p[90]:=232;e[90]:=1.3; n[91]:='Pa';p[91]:=231;e[91]:=1.5; n[92]:='U';p[92]:=238;e[92]:=1.7; end; procedure cerca1; begin datipo; for a:=1 to k do if e1=n[a] then h1:=e[a]; end; procedure cerca2; begin datipo; for a:=1 to k do if e2=n[a] then h2:=e[a]; end; procedure pro1; begin writeln('es. HCl..HF..HI..HBr..H2S..H2..N2..O2..Cl2..'); writeln('------------------------------------------'); 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); writeln('stampa valori elettronegativita e calcola differenza '); WRITELN(e1:8,e2:8,'De':8); writeln(h1:8:2,h2:8:2,h3:8:2); if h3<0.2 then legame:='legame covalente omopolare' else if ((h3>0.2) and (h3<1.7)) then legame:='legame covalente polare' else legame:='legame ionico'; writeln('legame tra elementi tipo :',legame); 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 pro2; begin writeln('es.idrossido di Na,Ca,Al,K,Fe,Sn,Pb..'); writeln('------------------------------------------'); write('scrivi simbolo metallo ');readln(e1); cerca1; h3:=3.5-h1; h2:=1.4; 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('stampa valori elettronegativita e calcola differenze '); writeln(e1:8,h1:8:2,'O':8,3.5:8:2,'H':8,2.1:8:2); writeln('De tra Ossigeno e ',e1:8,' = ',h3:0:2,' legame ionico'); writeln('De tra Ossigeno e Idrogeno = 1.4..legame covalente polare'); end; procedure pro3; var le:string; begin writeln('es.HNO3..H2SO4..H2CO3..HClO...HClO2..H3PO4..'); writeln('------------------------------------------'); write('scrivi simbolo elemento intermedio S,N,P,Cl.. ');readln(e1); cerca1; h3:=3.5-h1; h2:=1.4; if h3<1.7 then le:=' legame covalente polare' else le:=' legame ionico'; 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('stampa valori elettronegativita e calcola differenze '); writeln(e1:8,h1:8:2,'O':8,3.5:8:2,'H':8,2.1:8:2); writeln('De tra Ossigeno e ',e1:8,' = ',h3:0:2,le:8); writeln('De tra Ossigeno e Idrogeno = 1.4..legame covalente polare'); end; procedure pro4; begin writeln('es. CaO..K2O...FeO.....SO3...N2O3...CO2..'); writeln('------------------------------------------'); write('scrivi simbolo elememto metallico o non metallico:');readln(e1); cerca1; h2:=3.5;e2:='O'; (* 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); writeln('stampa valori elettronegativita e calcola differenza '); WRITELN(e1:8,e2:8,'De':8); writeln(h1:8:2,h2:8:2,h3:8:2); if h3<0.2 then legame:='legame covalente omopolare' else if ((h3>0.2) and (h3<1.7)) then legame:='legame covalente polare' else legame:='legame ionico'; writeln('legame tra elementi tipo :',legame); 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 pro5; var le:string; begin writeln('es.NaNO3...K2SO4...CaCO3....MgSO3..'); writeln('------------------------------------------'); write('scrivi simbolo metallo ..K..Ca..Na.. ');readln(e2); cerca2; h4:=3.5-h2; write('scrivi simbolo elemento intermedio S,N,P,Cl.. ');readln(e1); cerca1; h3:=3.5-h1; if h3<1.7 then le:=' legame covalente polare' else le:=' legame ionico'; 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('stampa valori elettronegativita e calcola differenze '); writeln(e2:8,h2:8:2,e1:8,h1:8:2,'O':8,3.5:8:2); writeln('De tra Ossigeno e ',e1:8,' = ',h3:0:2,le:8); writeln('De tra Ossigeno e ',e2:8,' = ',h4:0:2,' legame ionico'); end; procedure pro6; begin writeln('es. NaCl..CaF2..Al2S3..KF..MgCl2..'); writeln('------------------------------------------'); 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); writeln('stampa valori elettronegativita e calcola differenza '); WRITELN(e1:8,e2:8,'De':8); writeln(h1:8:2,h2:8:2,h3:8:2); if h3<0.2 then legame:='legame covalente omopolare' else if ((h3>0.2) and (h3<1.7)) then legame:='legame covalente polare' else legame:='legame ionico'; writeln('legame tra elementi tipo :',legame); 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 cancella; f:=0; repeat f:=f+1; if f>39 then f:=1; writeln('esempio di formule da analizzare: '); writeln('seleziona tipo di formula o fine per terminare'); writeln('------------------------------------------------------------'); writeln('1...cerca legame tra due atomi o elementi.. HCl..H2..N2..'); writeln('2...cerca legame tra elementi in idrossido NaOH..Ca(OH)2.'); writeln('3...cerca legame tra elementi in ossiacidi HNO3..H2SO4 '); writeln('4...cerca legame tra due atomi in ossidi o anidridi CaO..SO3..'); writeln('5...cerca legame tra atomi in sali ossigenati.NaNO3...'); writeln('6...cerca legame tra atomi in sali binari .. KCl..K2S..NaF..'); writeln('9...fine '); writeln('--------------------------------------------------------------'); write('opzione=');readln(s); cancella; case s of 1:pro1; 2:pro2; 3:pro3; 4:pro4; 5:pro5; 6:pro6; 9:fine; end; writeln('----------------------------'); writeln('altro problema:scrivi 1...fine:scrivi 2 ');readln(ancora);cancella; until ancora=2; end; begin cancella; (* FORMULE;*) writeln('programma:determina tipo legame chimico tra elementi'); writeln('---------------------------------------------------'); repeat write('indica numero prove <40 :');readln(prove); until prove<40; scelta; end. -----------esempio da non copiare con la selezione---------- es.idrossido di Na,Ca,Al,K,Fe,Sn,Pb.. ------------------------------------------ scrivi simbolo metallo Na legame covalente omopolare se De <0.2 legame covalente polare se 0.2 < De < 1.7 legame ionico se De >=1.7 stampa valori elettronegativita e calcola differenze Na 0.90 O 3.50 H 2.10 De tra Ossigeno e Na = 2.60 legame ionico De tra Ossigeno e Idrogeno = 1.4..legame covalente polare ---------------------------- altro problema:scrivi 1...fine:scrivi 2 ritorna