Program OSSIDO;
(* nomenclatura composti chimici OSSIDI CON VALUTAZIONE *)
(* con presentazione finale risposte inserite    *)
uses crt;
 const k1=10;k2=24;k3=15;k4=3;
 
var esatte,errate,totale,a:integer;
    ris,rip,h1,h2,h3,h4,q,a1:string;
    d1:array[1..k1] of string;
    d2:array[1..k2] of string;
    d3:array[1..k3] of string;
    d4:array[1..k4] of string;
    n1:array[1..k1] of string;
    n2:array[1..k2] of string;
    n3:array[1..k3] of string;
    n4:array[1..k4] of string;
    
    
procedure dati1;
begin
d1[1]:='Li';d1[2]:='Na';d1[3]:='K';d1[4]:='Rb';d1[5]:='Cs';d1[6]:='Fr';
d1[7]:='Cu';d1[8]:='Ag';d1[9]:='Au';d1[10]:='Hg';
n1[1]:='LITIO1';n1[2]:='SODIO1';n1[3]:='POTASSIO1';n1[4]:='RUBIDIO1';
n1[5]:='CESIO1';n1[6]:='FRANCIO1';n1[7]:='RAME1';n1[8]:='ARGENTO1';
n1[9]:='ORO1';n1[10]:='MERCURIO1';
end;

procedure dati2;
begin
d2[1]:='Be';d2[2]:='Mg';d2[3]:='Ca';d2[4]:='Sr';d2[5]:='Ba';d2[6]:='Ra';
d2[7]:='Cr';d2[8]:='Fe';d2[9]:='W';d2[10]:='Mo';d2[11]:='Mn';d2[12]:='Re';
d2[13]:='Ru';d2[14]:='Os';d2[15]:='Co';d2[16]:='Rh';d2[17]:='Ir';
d2[18]:='Ni';d2[19]:='Pd';d2[20]:='Pt';d2[21]:='Cu';d2[22]:='Zn';
d2[23]:='Cd';d2[24]:='Hg';n2[1]:='BERILLIO2';n2[2]:='MAGNESIO2';
n2[3]:='CALCIO2';n2[4]:='STRONZIO2';n2[5]:='BARIO2';n2[6]:='RADIO2';
n2[7]:='CROMO2';n2[8]:='FERRO2';n2[9]:='WOLFRAMIO2';n2[10]:='MOLIBDENO2';
n2[11]:='MANGANESE2';n2[12]:='RENIO2';n2[13]:='RUTENIO2';n2[14]:='OSMIO2';
n2[15]:='COBALTO2';n2[16]:='RODIO2';n2[17]:='IRIDIO2';
n2[18]:='NICHELIO2';n2[19]:='PALLADIO2';n2[20]:='PLATINO2';
n2[21]:='RAME2';n2[22]:='ZINCO2';n2[23]:='CADMIO2';n2[24]:='MERCURIO2';
end;

procedure dati3;
begin
d3[1]:='Cr';d3[2]:='Mn';d3[3]:='Mo';d3[4]:='W';d3[5]:='Fe';
d3[6]:='Ru';d3[7]:='Os';d3[8]:='Co';d3[9]:='Rh';d3[10]:='Ir';
d3[11]:='Ni';d3[12]:='Au';d3[13]:='Al';d3[14]:='Sb';d3[15]:='Bi';
n3[1]:='CROMO3';n3[2]:='MANGANESE3';n3[3]:='MOLIBDENO3';n3[4]:='WOLFRAMIO3';
n3[5]:='FERRO3';n3[6]:='RUTENIO3';n3[7]:='OSMIO3';n3[8]:='COBALTO3';
n3[9]:='RODIO3';n3[10]:='IRIDIO3';n3[11]:='NICHELIO3';n3[12]:='ORO3';
n3[13]:='ALLUMINIO3';n3[14]:='ANTIMONIO3';n3[15]:='BISMUTO3';
end;

procedure dati4;
begin
d4[1]:='Ge';d4[2]:='Sn';d4[3]:='Pb';
n4[1]:='GERMANIO4';n4[2]:='STAGNO4';n4[3]:='PIOMBO4';
end;
          
procedure pausa; 
begin
writeln('premi enter');readln;
end;
 
procedure cancella;
begin
clrscr;
end;

procedure fine;  
begin
writeln('fine operazione:confermare :premi enter');
readln;
end;

procedure verifica(ris,rip:string);
begin
if ris=rip then begin writeln('esatto');esatte:=esatte+1;end
else begin writeln('errato:era:',rip);errate:=errate+1;end;
writeln('-----------------------------------------------------');
end;
    
procedure base1;
begin
dati1;writeln('scrivi nome es. COMPOSTO DI NOME2 ');
for a:=1 to k1 do
begin
write(d1[a],'2',h1,q);readln(ris);rip:=concat(a1,n1[a]);verifica(ris,rip);
end;
end;

procedure base1a;
begin
dati1;writeln('scrivi formula es.  MeOH ...Me(OH)5 ');
for a:=1 to k1 do
begin
write(a1,n1[a],q);readln(ris);rip:=concat(d1[a],'2',h1);verifica(ris,rip);
end;
end;

procedure base2;
begin
dati2;writeln('scrivi nome es. COMPOSTO DI NOME2 ');
for a:=1 to k2 do
begin
write(d2[a],h2,q);readln(ris);rip:=concat(a1,n2[a]);verifica(ris,rip);
end;
end;

procedure base2a;
begin
dati2;writeln('scrivi formula es.  MeOH ...Me(OH)5 ');
for a:=1 to k2 do
begin
write(a1,n2[a],q);readln(ris);rip:=concat(d2[a],h2);verifica(ris,rip);
end;
end;

procedure base3;
begin
dati3;writeln('scrivi nome es. COMPOSTO DI NOME2 ');
for a:=1 to k3 do
begin
write(d3[a],'2',h3,q);readln(ris);rip:=concat(a1,n3[a]);verifica(ris,rip);
end;
end;

procedure base3a;
begin
dati3;writeln('scrivi formula es.  MeOH ...Me(OH)5 ');
for a:=1 to k3 do
begin
write(a1,n3[a],q);readln(ris);rip:=concat(d3[a],'2',h3);verifica(ris,rip);
end;
end;

procedure base4;
begin
dati4;writeln('scrivi nome es. COMPOSTO DI NOME2 ');
for a:=1 to k4 do
begin
write(d4[a],h4,q);readln(ris);rip:=concat(a1,n4[a]);verifica(ris,rip);
end;
end;

procedure base4a;
begin
dati4;writeln('scrivi formula es.  MeOH ...Me(OH)5 ');
for a:=1 to k4 do
begin
write(a1,n4[a],q);readln(ris);rip:=concat(d4[a],h4);verifica(ris,rip);
end;
end;


procedure pro1;
begin
base1;pausa;
end;

procedure pro2;
begin
base2;pausa;
end;

procedure pro3;
begin
base3;pausa;
end;

procedure pro4;
begin
base4;pausa;
end;

procedure pro5; (* inverso di base1 *)
begin
base1a;pausa;
end;

procedure pro6; (* inverso di base2 *)
begin
base2a;pausa;
end;

procedure pro7; (* inverso di base3 *)
begin
base3a;pausa;
end;

procedure pro8; (* inverso di base4 *)
begin
base4a;pausa;
end;

procedure pro9;
begin
base4a;pausa;cancella;base1;pausa;cancella;base3a;pausa;cancella;
base2;pausa;cancella;base1a;pausa;cancella;
base3;pausa;cancella;base2a;pausa;cancella;base4;pausa;cancella;
end;

procedure scelta;  
var s,sn:string;opzione:integer;
begin
cancella;;
writeln('seleziona opzione per NOMENCLATURA CHIMICA ');
writeln('1...data la formula,scrivi il nome ');
writeln('2...data la formula,scrivi il nome');
writeln('3...data la formula,scrivi il nome ');
writeln('4...data la formula,scrivi il nome');
writeln('5...dato il nome scrivi la formula');
writeln('6...dato il nome scrivi la formula');
writeln('7...dato il nome scrivi la formula');
writeln('8...dato il nome scrivi la formula');
writeln('9...riassume precedenti1,2,3,4,5,6,7,8');

writeln('15...fine ');
writeln('scelta =');readln(opzione);cancella;
case opzione of
1:pro1;2:pro2;3:pro3;4:pro4;5:pro5;6:pro6;7:pro7;8:pro8;9:pro9;
15:fine;
end;
writeln('altra operazione?Esperimenti?:premi S...fine:premi N '); readln(sn);
if ((sn='S') or (sn='s')) then scelta ;
end;



begin            (* programma di lancio *)
cancella;
writeln('ATTENZIONE:scrivere le risposte in maiuscolo');
writeln('senza spaziatura prima e dopo la risposta ');
writeln('indicare la valenza ');
writeln('es.  OSSIDO DI SODIO1       Al203  ');pausa;cancella;
h1:='O';h2:='O';h3:='O3';h4:='O2';q:='   ';
a1:='OSSIDO DI ';
esatte:=0;errate:=0;totale:=0;
scelta;cancella;
writeln('risposte esatte  ',esatte,' su domande ',totale);
writeln('risposte errate  ',errate,' su domande ',totale);
writeln('premi ENTER per rivedere le tue risposte');pausa;
writeln('chiama insegnante per valutazione ');pausa;
pausa;
end.