Calculatrice et opération
Bonjour,
je veux faire une calculatrice . Je suis sous delphi 2005.
J'ai 1 seul label qui doit me permettre d'effectuer les opérations comme la calculatrice standard de Windows!
Mon problème est que je ne vois pas comment faire,
Lorsque j'appuie sur le bouton "2" , je dois choisir l'opération "+,-,/,*," et j'appuie sur le bouton "3", le résultat doit me s'afficher dans le label !
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| unit cal5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button15: TButton;
Label1: TLabel;
Button16: TButton;
procedure Button10Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.caption:=Button1.caption;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
label1.caption:=Button2.caption;
end;
procedure TForm1.Button16Click(Sender: TObject);
begin
close();
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
label1.Caption:= button3.Caption ;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
label1.Caption:= button4.Caption ;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
label1.Caption:= button5.Caption ;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
label1.Caption:= button6.Caption ;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
label1.Caption:= button7.Caption ;
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
label1.Caption:= button8.Caption ;
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
label1.Caption:= button9.Caption ;
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
label1.Caption:= button10.Caption ;
end;
end. |
Je ne vois pas comment faire sa lorsque je cliques sur le bouton "+" et à la fin le bouton "=" qui doit me rendre le résultat?
Ce que je cherche c'est comment on procède au niveau conception ?