Bonjour,

je travail avec Borland C++, je souhaite faire une comparaison entre deux nombres entier si (a<b) il m'affiche ("a plus grand") sinon il m'affiche ("b plus grand").

ma fenêtre contient 2 Edits : Edit1 'a' et Edit2 'b' et un bouton 'comparerButton'.

normalement lorsque je saisie un entier dans 'a' et l'autre dans 'b' et je clique sur 'comparerButton' il m'affiche un message ("a plus grand" ou "b plus grand").


Mon code complet:

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
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
 
//---------------------------------------------------------------------------
 
 
#ifndef FichePrincipaleH
#define FichePrincipaleH
 
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
 
//---------------------------------------------------------------------------
 
 
//---------------------------------------------------------------------------
 
class TForm1 : public TForm
{
__published:	// Composants gérés par l'EDI
    TEdit *a;
    TEdit *b;
    TButton *comparerButton;
 
 
 
private:	// Déclarations utilisateur
public:		// Déclarations utilisateur
    __fastcall TForm1(TComponent* Owner);
};
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
 
 
//---------------------------------------------------------------------------
 
 
 
 
 
 
//---------------------------------------------------------------------------
 
 
void __fastcall TForm1::bEnter(TObject *Sender)
{
SetWindowLong(b->Handle,GWL_STYLE,
                GetWindowLong(b->Handle,GWL_STYLE)
                                            | ES_NUMBER );
 
}
//---------------------------------------------------------------------------
void __fastcall TForm1::aEnter(TObject *Sender)
{
SetWindowLong(a->Handle,GWL_STYLE,
                GetWindowLong(a->Handle,GWL_STYLE)
                                            | ES_NUMBER );
}
//---------------------------------------------------------------------------
 
void __fastcall TForm1::aChange(TObject *Sender)
{
     int a = 0;
    try { // L'exception sera déclenchée si le contenu de
          // la zone est vide
        valeur = StrToInt(a->Text);
    }
 
}
//---------------------------------------------------------------------------
 
 
void __fastcall TForm1::bChange(TObject *Sender)
{
     int b = 0;
    try { // L'exception sera déclenchée si le contenu de
          // la zone est vide
        valeur = StrToInt(b->Text);
    }
}
//---------------------------------------------------------------------------
 
void __fastcall TForm1::comparerButtonClick(TObject *Sender)
{
     	if (a>b){
	ShowMessage("a plus grand");}
 
             	else
	{ShowMessage("b plus grand");
 	}
 
}
//---------------------------------------------------------------------------
il m'affiche 5 problèmes qui sont :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
  [C++ Error] Unit1.cpp(47): E2316 '_fastcall TForm1::bEnter(TObject *)' is not a member of 'TForm1'
 
  [C++ Error] Unit1.cpp(55): E2316 '_fastcall TForm1::aEnter(TObject *)' is not a member of 'TForm1'
 
  [C++ Error] Unit1.cpp(63): E2316 '_fastcall TForm1::aChange(TObject *)' is not a member of 'TForm1'
 
  [C++ Error] Unit1.cpp(75): E2316 '_fastcall TForm1::bChange(TObject *)' is not a member of 'TForm1'
 
  [C++ Error] Unit1.cpp(85): E2316 '_fastcall TForm1::comparerButtonClick(TObject *)' is not a member of 'TForm1'
j'attend vos réponse avec impatience.
Merci bien.