Caculatrice

cs_Grenouille540 Messages postés 4 Date d'inscription dimanche 9 mai 2010 Statut Membre Dernière intervention 18 juin 2010 - 17 juin 2010 à 16:23
LukorNemuse Messages postés 4 Date d'inscription mardi 25 mai 2010 Statut Membre Dernière intervention 21 juin 2010 - 21 juin 2010 à 16:41
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Cacul.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Bp_Click(TObject *Sender)// Déclaration des boutons
{
char c;
if(dynamic_cast<TButton*>(Sender)==Bp_0)c='0';
if(dynamic_cast<TButton*>(Sender)==Bp_1)c='1';
if(dynamic_cast<TButton*>(Sender)==Bp_2)c='2';
if(dynamic_cast<TButton*>(Sender)==Bp_3)c='3';
if(dynamic_cast<TButton*>(Sender)==Bp_4)c='4';
if(dynamic_cast<TButton*>(Sender)==Bp_5)c='5';
if(dynamic_cast<TButton*>(Sender)==Bp_6)c='6';
if(dynamic_cast<TButton*>(Sender)==Bp_7)c='7';
if(dynamic_cast<TButton*>(Sender)==Bp_8)c='8';
if(dynamic_cast<TButton*>(Sender)==Bp_9)c='9';
if(dynamic_cast<TButton*>(Sender)==Bp_point)c=',';
ajout(c);
}
//---------------------------------------------------------------------------
void TForm1::ajout(char lettre)// Déclaration pour la virgule
{
if(max_caract<=20)
{
if(max_caract==0 && lettre!=',')
{
Edit->Text=' ';
}
if(!drap_virg ||(drap_virg && lettre!=','))
{
Edit->Text=Edit->Text+lettre;
max_caract++;
}
if(lettre==',')
{
drap_virg=true;
}
}
}

//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
max_caract=0;
drap_virg=false;
}
//---------------------------------------------------------------------------
void TForm1::calcul(char op) //Permet d'obtenir les opérations vouluent
{
switch(op)
{
case'+':break;
case'-':break;
case'x':break;
case'/':break;
}
}
//--------------------------------------------------------------------------
void __fastcall TForm1::Bp_opClick(TObject *Sender)//Déclaration des boutons opé
{
char operation;
if(dynamic_cast<TButton*>(Sender)==Bp_moin)operation='-';
if(dynamic_cast<TButton*>(Sender)==Bp_plus)operation='+';
if(dynamic_cast<TButton*>(Sender)==Bp_multi)operation='x';
if(dynamic_cast<TButton*>(Sender)==Bp_divise)operation='/';
if(dynamic_cast<TButton*>(Sender)==Bp_egale)operation='=';
calcul(operation);
}
//---------------------------------------------------------------------------

JE SUIS BLOQUE UN PETIT COUP DE POUCE SVP MERCI

L'avenir appartient à ceux qui se lève tôt!

1 réponse

LukorNemuse Messages postés 4 Date d'inscription mardi 25 mai 2010 Statut Membre Dernière intervention 21 juin 2010 1
21 juin 2010 à 16:41
Pour obtenir une réponse, il faut poser une question.
1
Rejoignez-nous