Newsgroup: it.comp.lang.pascal
Titolo: AIUTINO: e' una svista o un errore vero..????

ciao a tutti,
chi e' cosi' gentile da correggere questo semplice programmino...
io non ci riesco..
..aaahhhhh, dimenticavo, solo correggere e non modificare!
grazie a tutti per la cura con la quale 'spero' vi occuperete di me.
carola
...........................................................
program Building_a_Computer;
uses Crt;
const  {A fixed value}
Vrate=18;
Drate=10;
var   {Changing values}
name:array[1..100]of char;
ram,mb,hdd,fdd,dvdrom,grcard,tower,powsup,monitor,tot,sum,labour,Dprice,pr,newpr:real;
k,nn,n,count,ans:integer;
quit_check: char;
estimate:string;
validated:real;
procedure validation (var Y:integer; m: real);
var
correct : boolean;
begin
     validated := 0;
     repeat
     correct := true;
     if (m < 0) THEN
     begin
          correct:= false;
          gotoxy (24, y);
          clreol;
          readln (m);
     end;
     until correct = true;
     validated :=m;
end;
procedure total;
begin
writeln;
sum:=0;
sum:=ram+mb+hdd+fdd+dvdrom+grcard+tower+powsup+monitor+labour;
gotoxy(7,41);
writeln('The price is Lm ',sum:4:2);
tot:=0;
tot:=sum+(sum*vrate/100); {That's the formulae to calculate the sum
included of Vat}
gotoxy(7,43);
writeln('The total price with ', VRate, '% Vat included is Lm ',tot:4:2);
if tot>100 then
begin
dprice:=tot-(tot*drate/100);
gotoxy(7,45);
textcolor(red); {It highlights in red the sum and the total}
writeln('The discounted price is Lm ',dprice:4:2);
   textcolor(white); {It goes back to the white colour}
end;
end;
procedure input_data;
var
y : integer;
begin
     y := 8;
     gotoxy(7,y);
     writeln('1) Ram     Lm ');
     gotoxy(24,y);
     readln (ram);
     validation (y,ram);
     ram := validated;
     y := 9;
     gotoxy(7,y);
     writeln('2) Mb      Lm ');
     gotoxy(24,y);
     readln(mb);
     validation (y,mb);
     mb := validated;
     y := 10;
     gotoxy(7,y);
     writeln('3) Hdd     Lm ');
     gotoxy(24,y);
     readln(hdd);
     validation (y, hdd);
     hdd := validated;
     y := 11;
     gotoxy(7,y);
     writeln('4) Fdd     Lm ');
     gotoxy(24,y);
     readln(fdd);
     validation (y,fdd);
     fdd := validated;
     y := 12;
     gotoxy(7,y);
     writeln('5) Dvdrom  Lm ');
     gotoxy(24,y);
     readln(dvdrom);
     validation (y,dvdrom);
     dvdrom := validated;
     y := 13;
     gotoxy(7,y);
     writeln('6) Grcard  Lm ');
     gotoxy(24,y);
     readln(grcard);
     validation (y,grcard);
     grcard := validated;
     y := 14;
     gotoxy(7,y);
     writeln('7) Tower   Lm ');
     gotoxy(24,y);
     readln(tower);
     validation (y,tower);
     tower := validated;
     y := 15;
     gotoxy(7,y);
     writeln('8) Powsup  Lm ');
     gotoxy(24,y);
     readln(powsup);
     validation (y, powsup);
     powsup := validated;
     y := 16;
     gotoxy(7,y);
     writeln('9) Monitor Lm ');
     gotoxy(24,y);
     readln(monitor);
     validation (y, monitor);
     monitor := validated;
     y := 17;
     gotoxy(7,y);
     writeln('10) Labour Lm ');
     gotoxy(24,y);
     readln(labour);
     validation (y, labour);
     labour := validated;
end;
procedure continue;
var
      y:integer;
begin
y:=18;
gotoxy(7,y);
writeln('Would you add more items at the present list?(y/anykey)');
gotoxy(70,y);
readln(ans);
if ans='y'then
begin
y:=19;
gotoxy(7,y);
writeln(' How many items would you like to add?');
gotoxy(60,y);
readln(nn);
k:=0;
newpr:=0;
repeat
k:=k+1;
delay(10);
writeln(' - Input the new item : ');
readln(item);
newpr:=newpr+pr;
writeln(' Total new item : ',newpr:4:2);
until k=nn;
end;
begin {Output on screen}
      clrscr;
 
 
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
 
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
 
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
      repeat
      begin
           gotoxy(1,7);
           writeln(' Estimate purchase of Mr/Madame (Press "Q" to quit): 
Lm ');
           gotoxy(57,7);
           readln(estimate);
           if estimate = 'q' then
              exit;
      end;
      input_data;
      total;
      continue;
 
      gotoxy(7,48);
      writeln;
      writeln;
      writeln('Press ENTER for next estimate of purchase or press "Q" to
quit...');
      quit_check:=readkey;
      clrscr;
 
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
 
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
 
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
      until (quit_check = 'Q') or (quit_check = 'q');
end.
-- 
questo articolo e` stato inviato via web dal servizio gratuito 
http://www.newsland.it/news
 segnala gli abusi ad 
ab...@newsland.it

Cerca i (*******
program Building_a_Computer;
uses Crt;
const  {A fixed value}
Vrate=18;
Drate=10;
var   {Changing values}
name:array[1..100]of char;
ram,mb,hdd,fdd,dvdrom,grcard,tower,powsup,monitor,tot,sum,labour,Dprice,pr,newpr:real;
k,nn,n,count,item:integer;
ans,quit_check: char;        (******* ans deve essere un char ******)
estimate:string;
validated:real;


procedure total;
begin
writeln;
sum:=0;




end;










end;
procedure continue;
var
       y:integer;


end;               (******* credo che l'end vada qui' comunque controlla 
  *********)
k:=0;
newpr:=0;

begin {Output on screen}
       clrscr;
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
       repeat


       input_data;
       total;
       continue;

       clrscr;
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');

end.
Bye,
David

 David
