tupw
Legacy Member
ik zit met een probleem.Als ik prober te runnen en ik voer een kommagetal in bv 16.30 dan geeft ie een error, kan je me helpen. Normaal moe ik een kommagtal ingeven bv 18.36 en hij zegt dan op het einde je hebt zoveel minten van2euro nodig, 5 cent,ec...
PROGRAM oefening9;
Uses WinCrt;
Const Titel = 'Muntstukken';
VAR S2,SR2,S1,SR1,VoorKomma,euro:integer;
NaKomma, SO50, SO50R, SO20: real;
SO20R, SO10, SO10R, SO05, SO05R, SO02, SO02R, SO01,SO01R:real;
PROCEDURE DrukTitel;
BEGIN
writeln(Titel);
END;
PROCEDURE VraagGegevens;
BEGIN
write('Geef een bedrag in euro die u wilt omrekenen :');
readln(euro);
END;
PROCEDURE GegevensOmrekenen;
BEGIN
VoorKomma:=TRUNC(euro);
S2:=euro DIV 2;
SR2:=euro MOD 2;
S1:=SR2 DIV 1;
SR1:= SR2 MOD 1;
NaKomma:=FRAC(euro);
SO50:=TRUNC(NaKomma/0.50);
SO50R:=FRAC(NaKomma-SO50*0.50);
SO20:=TRUNC(SO50R/0.20);
SO20R:=FRAC(SO50R-SO20*0.20);
SO10:=TRUNC(SO20R/0.10);
SO10R:=FRAC(SO20R-SO10*0.10);
SO05:=TRUNC(SO10R/0.05);
SO05R:=FRAC(SO10R-SO05*0.05);
SO02:=TRUNC(SO05R/0.02);
SO02R:=FRAC(SO05R-SO02*0.02);
SO01:=TRUNC(SO02R/0.01);
SO01R:=FRAC(SO02R-SO01*0.01);
END;
PROCEDURE uitkomst;
BEGIN
writeln('Je hebt het volgende nodig: ',S2,' 2euro, ',S1,' 1euro,');
writeln(' ',SO50,' 50cent, ',SO20,' 20 cent,');
writeln(' ',SO10,' 10cent, ',SO05,' 5 cent,');
writeln(' ',SO02,' 2 cent, ',SO01,' 1 cent.');
END;
BEGIN
DrukTitel;
VraagGegevens;
GegevensOmrekenen;
uitkomst;
PROGRAM oefening9;
Uses WinCrt;
Const Titel = 'Muntstukken';
VAR S2,SR2,S1,SR1,VoorKomma,euro:integer;
NaKomma, SO50, SO50R, SO20: real;
SO20R, SO10, SO10R, SO05, SO05R, SO02, SO02R, SO01,SO01R:real;
PROCEDURE DrukTitel;
BEGIN
writeln(Titel);
END;
PROCEDURE VraagGegevens;
BEGIN
write('Geef een bedrag in euro die u wilt omrekenen :');
readln(euro);
END;
PROCEDURE GegevensOmrekenen;
BEGIN
VoorKomma:=TRUNC(euro);
S2:=euro DIV 2;
SR2:=euro MOD 2;
S1:=SR2 DIV 1;
SR1:= SR2 MOD 1;
NaKomma:=FRAC(euro);
SO50:=TRUNC(NaKomma/0.50);
SO50R:=FRAC(NaKomma-SO50*0.50);
SO20:=TRUNC(SO50R/0.20);
SO20R:=FRAC(SO50R-SO20*0.20);
SO10:=TRUNC(SO20R/0.10);
SO10R:=FRAC(SO20R-SO10*0.10);
SO05:=TRUNC(SO10R/0.05);
SO05R:=FRAC(SO10R-SO05*0.05);
SO02:=TRUNC(SO05R/0.02);
SO02R:=FRAC(SO05R-SO02*0.02);
SO01:=TRUNC(SO02R/0.01);
SO01R:=FRAC(SO02R-SO01*0.01);
END;
PROCEDURE uitkomst;
BEGIN
writeln('Je hebt het volgende nodig: ',S2,' 2euro, ',S1,' 1euro,');
writeln(' ',SO50,' 50cent, ',SO20,' 20 cent,');
writeln(' ',SO10,' 10cent, ',SO05,' 5 cent,');
writeln(' ',SO02,' 2 cent, ',SO01,' 1 cent.');
END;
BEGIN
DrukTitel;
VraagGegevens;
GegevensOmrekenen;
uitkomst;