The good old delphi... Link proiect: http://rapidshare.com/share/A6C3EA1ED588D085902E300DF8AA1ADA unit fVectorUnit; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, Menus; type TfVector = class(TForm) mm: TMainMenu; Fiseire1: TMenuItem; Deschidere1: TMenuItem; ParasireAplicatie1: TMenuItem; Vizualizare1: TMenuItem; Calcul1: TMenuItem; Calculeaza1: TMenuItem; Vizualizarevector1: TMenuItem; reVector: TRichEdit; OD: TOpenDialog; procedure Deschidere1Click(Sender: TObject); procedure ParasireAplicatie1Click(Sender: TObject); procedure Vizualizarevector1Click(Sender: TObject); procedure Calculeaza1Click(Sender: TObject); private { Private declarations } public Vector: array of real; { Public declarations } end; var fVector: TfVector; implementation uses fMinMaxUnit; {$R *.dfm} procedure TfVector.Deschidere1Click(Sender: TObject); var List: TStringList; I: Integer; begin OD.InitialDir := ExtractFilePath(Application.ExeName); if OD.Execute then begin List := TStringList.Create; try List.LoadFromFile(OD.FileName); SetLength(Vector, List.Count); for I := 0 to High(Vector) do begin try Vector[I] := StrToFloat(List.Strings[I]) except MessageDlg('Date invalide!', mtError, [mbOk], 0); Vector := nil; Break; end; end; finally List.Free; end; end; end; procedure TfVector.ParasireAplicatie1Click(Sender: TObject); begin if MessageDlg('Sigur doriti sa parasiti aplicatia?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then Application.Terminate; end; procedure TfVector.Vizualizarevector1Click(Sender: TObject); var I: Integer; begin if Length(Vector) = 0 then begin MessageDlg('Baza de date nu a fost incarcata!', mtInformation, [mbOk], 0); Exit; end; for I := 0 to High(Vector) do reVector.Lines.Add('v[' + IntToStr(I) + ']='+ FloatToStrF(Vector[I], ffFixed, 3, 3)) end; procedure TfVector.Calculeaza1Click(Sender: TObject); begin if Length(Vector) = 0 then begin MessageDlg('Baza de date nu a fost incarcata!', mtInformation, [mbOk], 0); Exit; end; fMinMax.ShowModal; end; end. unit fMinMaxUnit; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TfMinMax = class(TForm) rbMin: TRadioButton; rbMax: TRadioButton; bCalc: TButton; bClose: TButton; procedure bCloseClick(Sender: TObject); procedure bCalcClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var fMinMax: TfMinMax; implementation uses fVectorUnit; {$R *.dfm} function MaxVector: real; var I: Integer; M: real; begin M := fVector.Vector[Low(fVector.Vector)]; for I := 1 to High(fVector.Vector) do if fVector.Vector[I] > M then M := fVector.Vector[I]; Result := M; end; function MinVector: real; var I: Integer; M: real; begin M := fVector.Vector[Low(fVector.Vector)]; for I := 1 to High(fVector.Vector) do if fVector.Vector[I] < M then M := fVector.Vector[I]; Result := M; end; procedure TfMinMax.bCalcClick(Sender: TObject); var MinMax: real; I: Integer; begin if rbMin.Checked then MessageDlg('Elementul minim: ' + FloatToStrF(MinVector, ffFixed, 3, 3), mtInformation, [mbOk], 0) else MessageDlg('Elementul maxim: ' + FloatToStrF(MaxVector, ffFixed, 3, 3), mtInformation, [mbOk], 0) end; procedure TfMinMax.bCloseClick(Sender: TObject); begin Close; end; end.