Bonsoir a tous,
J'ai un petit soucis avec un bout de code si vous pouvez m'aidez sa serai cool,
Donc mon soucis viens de la multiplication j'aimerai que quand je fait par exemple 2x2 au bou du 2eme clik sur le fois sa me donne le résultat dans le label et ainsi de suite
une petit schéma pour essayer d’être claire :
2----->"x"------->2------>"x"------->affichage du résultat...
ce code marche avec une addition mai pas la multiplication pourquoi?
voici le code et merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 //--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include<math.h> #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; int OP=0; float NOMBRE1=0; float NOMBRE2=0; float NOMBREINI=0; char OPERATION=0; float RESULTATS=0; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::unClick(TObject *Sender) { Edit1->Text=Edit1->Text+1; } //--------------------------------------------------------------------------- void __fastcall TForm1::plusClick(TObject *Sender) { NOMBRE1=StrToFloat(Edit1->Text); NOMBREINI+=NOMBRE1; Edit1->Text=""; Label1->Caption=NOMBREINI; } //--------------------------------------------------------------------------- void __fastcall TForm1::deuxClick(TObject *Sender) { Edit1->Text=Edit1->Text+2; } void __fastcall TForm1::foisClick(TObject *Sender) { NOMBRE1=StrToFloat(Edit1->Text); NOMBREINI*=NOMBRE1; Edit1->Text=""; Label1->Caption=NOMBREINI; } //---------------------------------------------------------------------------
Partager