|
program scommessa;
Uses crt;
var i,quot,val,k:integer;
tot:real;
begin
k:=15;
textcolor(yellow); textbackground(lightblue);
clrscr;
writeln('Programma che calcola la vincita di una scommessa');
textcolor(lightred);
writeln('ATTENZIONE:Inserisci le percentuali non scontate e senza virgole!!');
gotoxy(1,4);
textcolor(8);
writeln('PER ESEMPIO:');
gotoxy(1,6);
writeln(' | 1 | X | 2 |');
writeln('Napoli-Inter |3.50 |2.20 |2.30 |');
gotoxy(1,9);
writeln('Per mettere la vittoria del Napoli, la percentuale da inserire Š = 350');
gotoxy(1,11);
textcolor(3);
writeln('Premi invio per continuare');
readln();
tot:=1;
repeat
textcolor(11);
write('Inserisci la puntata in euro = ');
readln(quot);
until quot>0;
i:=1;
while val<>999 do
begin
textcolor(11);
gotoxy(1,k);
k:=k+2;
write('Inserisci la ',i,'ø percentuale = ');
readln(val);
if val<=100 then
begin
gotoxy(1,k);
textcolor(lightred);
writeln('Errore!. La percentuale inserita non esiste!!');
readln;
end;
if i=1 then
begin
textcolor(yellow);
writeln('Dopo aver inserito tutte le vostre puntate, nell''ultima inserite 999');
end;
i:=i+1;
if val<>999 then
tot:=tot*quot*val/100;
quot:=1;
if tot<=0 then
begin
gotoxy(1,k);
textcolor(lightred);
writeln('Errore!!');
k:=k+1;
if tot<0 then
gotoxy(1,k);
writeln('Il vincita Š troppo grande da essere contata!');
readln();
end
else
begin
gotoxy(46,k-2);
textcolor(lightgreen);
if val<>999 then
writeln('<-- Vincita Š circa ',tot:0:2,' euro!!');
end;
end;
gotoxy(1,k);
writeln('La vincita in totale Š circa ',tot:0:2,' euro!!');
textcolor(2);
gotoxy(1,k+2);
writeln('Il risultato finale si conta partendo dopo il punto, da destra');
writeln('verso sinistra e mettendo ogni 3 cifre la virgola.');
writeln('Ad esempio: 1317.52 In euro Š 1,317.52');
textcolor(8);
writeln(' Milletrecentodiciasette euro e cinquantadue centesimi');
readln();
end.
|
|