Posté le: 12 11 2002 19:52 Sujet du message: Unite pourri |
|
|
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ufichier, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
Button3: TButton;
Button4: TButton;
Bevel1: TBevel;
procedure Button4Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button4Click(Sender: TObject);
begin
application.Terminate;
end;
procedure TForm1.Button1Click(Sender: TObject);
const sentinelle= 32767;
var source,modif,resultat:textfile;
item,itemmodif,quantite,quantmodif:integer;
operation:char;
prix,prixmodif:real;
Success: Byte;
begin
ouverturefichierenlecture(source,success);
ouverturefichierenlecture(Modif,success);
ouverturefichierenlecture(Resultat,success);
WHILE NOT EOF(Modif) DO
Begin
READ(Modif, Operation, ItemModif);
WHILE Item <ItemModif DO
Begin
WRITELN(Resultat, Item ,Quantite, Prix);
IF NOT EOF (Source) then readln(source,item,quantite)
else item:=sentinelle;
end;
case operation of
'a':begin read(modif,quantmodif,prixmodif);
writeln(resultat,itemmodif,prixmodif);
end;
'E':if not eof(source) then readln(source,item,quantite,prix)
else item:=sentinelle;
'N': begin
read(modif,quantmodif);quantite:=quantite+quantmodif;
end;
end;
readln(modif);
end;
if item<> sentinelle then
begin
while not eof(source) do
begin
writeln(resultat,item,quantite,prix);
readln(source,item,quantite,prix);
end;
writeln(resultat,item,quantite,prix);
end;
closefile(source);closefile(modif);closefile(resultat);
write('ok! operation terminer');
end;
end. |
|
Invité
|