comment ça marche les variables numerique svp .

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
bernard13
Messages : 1221
Inscription : mer. 05/janv./2005 21:30

comment ça marche les variables numerique svp .

Message par bernard13 »

desoler personne ne m'aime , je posterai plus de code

tous le monde me deteste ici .

adieu
Dernière modification par bernard13 le lun. 14/nov./2005 8:33, modifié 2 fois.
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

Rien à cirer des variables numériques :twisted:
bernard13
Messages : 1221
Inscription : mer. 05/janv./2005 21:30

Message par bernard13 »

pourquoi ?

explique
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Message par Backup »

Chris a écrit :Rien à cirer des variables numériques :twisted:
:lol: :lol: :lol: :lol: :lol: :lol: :lol:
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

T'as la mémoire courte, mon bonhomme.

Vas donc faire un tour dans tes derniers posts en "Hors Sujet", histoire de te rafraichir la mémoire.
bernard13
Messages : 1221
Inscription : mer. 05/janv./2005 21:30

Message par bernard13 »

et alors je dis que ce que je pense
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

Ouais...
Et ben moi aussi :x
bernard13
Messages : 1221
Inscription : mer. 05/janv./2005 21:30

Message par bernard13 »

arrete un peu
aide moi svp chris
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

Un jour....
peut-être....
bernard13
Messages : 1221
Inscription : mer. 05/janv./2005 21:30

Message par bernard13 »

tu es pas sympas #cul
Anonyme2
Messages : 3518
Inscription : jeu. 22/janv./2004 14:31
Localisation : Sourans

Message par Anonyme2 »

Bernard13, je ne comprend pas ta question

tu veux savoir quoi ?
bernard13
Messages : 1221
Inscription : mer. 05/janv./2005 21:30

Message par bernard13 »

je veux savoir comment ca marche les variables numerique
lionel_om
Messages : 1500
Inscription : jeu. 25/mars/2004 11:23
Localisation : Sophia Antipolis (Nice)
Contact :

Message par lionel_om »

cad ? explain !!!
Pose une vraie question !
Webmestre de Basic-univers
Participez à son extension: ajouter vos programmes et partagez vos codes !
bernard13
Messages : 1221
Inscription : mer. 05/janv./2005 21:30

Message par bernard13 »

MON problemes est :

si je calcule carte bleu+carte rouge le programme me marque 18
exemple si je rentre 1 + 1 ca marque 18

qui peux m'aider a resoudre le probleme
svp merci

Code : Tout sélectionner


;exemple d'un bon de commande 

; constante de la fenetre et des gadgets 
;
Enumeration
  #Window_0
EndEnumeration
Enumeration
  #Text_titre
  #Text_nom
  #String_nom
  #Text_adresse
  #String_adresse
  #Text_ville
  #String_ville
  #Text_carteB
  #String_cb
  #Text_carteR
  #String_cr
  #Text_prixU
  #String_prixU
  #Text_totalc
  #String_totalc
  #Text_Total
  #String_7
  #Button_Calcule
  #Button_Effacer
  #Button_Quit
EndEnumeration 
 
 
; Fonts
Global FontID1
FontID1 = LoadFont(1, "Times New Roman", 24, #PB_Font_Bold)
Global FontID2
FontID2 = LoadFont(2, "Times New Roman", 12)



Global cb
Global cr


 Procedure effacer()
 If CreateGadgetList(WindowID())
   SetGadgetText(#String_nom,"")
   SetGadgetText(#String_adresse,"")
   SetGadgetText(#String_ville,"")
   SetGadgetText(#String_cb,"")
   SetGadgetText(#String_cr,"")
   SetGadgetText(#String_totalc,"")
   SetGadgetText(#String_7,"")
   ActivateGadget(#String_nom)
 
 EndIf
 
 EndProcedure
 Procedure calculer()
 ;Total=#String_cb + #String_cr
 cb=#String_cb
 cr=#String_cr
 Total=cb+cr
 
 SetGadgetText(#String_totalc,""+Total)

 
 
 
 EndProcedure
 
 
 Procedure main()
 
  If OpenWindow(#window_0,0,0,642,482,#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered,"Bon de commande")                                  
  If CreateGadgetList(WindowID())
      TextGadget(#Text_titre, 60, 25, 525, 40,"Bon de commande de magic-shop", #PB_Text_Center)
      SetGadgetFont(#Text_titre, FontID1)
      TextGadget(#Text_nom, 10, 105, 65, 20," Nom :", #PB_Text_Center)
      SetGadgetFont(#Text_nom, FontID2)
      StringGadget(#String_nom, 85, 105, 230, 25, "")
      TextGadget(#Text_adresse, 15, 150, 65, 25, "Adresse :", #PB_Text_Center)
      SetGadgetFont(#Text_adresse, FontID2)
      StringGadget(#String_adresse, 85, 150, 230, 25, "")
      TextGadget(#Text_ville, 5, 195, 60, 25, "Ville :", #PB_Text_Center)
      SetGadgetFont(#Text_ville, FontID2)
      StringGadget(#String_ville, 85, 200, 230, 25, "")
      TextGadget(#Text_carteB, 10, 270, 95, 20, "Carte bleue :", #PB_Text_Center)
      SetGadgetFont(#Text_carteB, FontID2)
      StringGadget(#String_cb, 115, 270, 45, 25, "",#PB_String_Numeric)
      TextGadget(#Text_carteR, 20, 320, 80, 25, "Carte rouge :", #PB_Text_Center)
      SetGadgetFont(#Text_carteR, FontID2)
      StringGadget(#String_cr, 115, 320, 45, 25, "",#PB_String_Numeric)
      TextGadget(#Text_prixU, 370, 100, 90, 20, "prix unitaire :",#PB_Text_Center)
      SetGadgetFont(#Text_prixU, FontID2)
      StringGadget(#String_prixU, 495, 100, 55, 30, "",#PB_String_Numeric)
      TextGadget(#Text_totalc, 365, 170, 115, 20, "Total des cartes :", #PB_Text_Center)
      SetGadgetFont(#Text_totalc, FontID2)
      StringGadget(#String_totalc, 495, 165, 55, 30, "", #PB_String_ReadOnly|#PB_String_Numeric)
      TextGadget(#Text_Total, 360, 225, 65, 25, "Total :", #PB_Text_Center)
      SetGadgetFont(#Text_Total, FontID2)
      StringGadget(#String_7, 495, 220, 55, 30, "", #PB_String_ReadOnly|#PB_String_Numeric)
      ButtonGadget(#Button_Calcule, 30, 395, 135, 40, "Calculer")
      GadgetToolTip(#Button_Calcule, "Calculer la commande ")
      SetGadgetFont(#Button_Calcule, FontID2)
      ButtonGadget(#Button_Effacer, 240, 395, 135, 40, "Effacer")
      GadgetToolTip(#Button_Effacer, " effacer les champs")
      SetGadgetFont(#Button_Effacer, FontID2)
      ButtonGadget(#Button_Quit, 450, 395, 135, 40, "Quitter")
      SetGadgetFont(#Button_Quit, FontID2)
       
  EndIf
  EndIf
  EndProcedure
  
 
 main()
 
 Repeat
   event=WaitWindowEvent()
    Select event
    Case #PB_Event_Gadget
     Select EventGadgetID()
      Case #Button_Calcule:calculer()
      Case #Button_Effacer:effacer()
      Case #Button_Quit:
      fermer=1
      EndSelect
    
    
    Case #PB_Event_CloseWindow
    fermer=1
    EndSelect
   Until fermer=1
   End
   
  
olivier
Messages : 305
Inscription : mer. 05/janv./2005 12:58
Localisation : http://www.tib-net.com/meca/index.htm

Message par olivier »

Code : Tout sélectionner

;exemple d'un bon de commande

; constante de la fenetre et des gadgets
;
Enumeration
    #Window_0
EndEnumeration
Enumeration
    #Text_titre
    #Text_nom
    #String_nom
    #Text_adresse
    #String_adresse
    #Text_ville
    #String_ville
    #Text_carteB
    #String_cb
    #Text_carteR
    #String_cr
    #Text_prixU
    #String_prixU
    #Text_totalc
    #String_totalc
    #Text_Total
    #String_7
    #Button_Calcule
    #Button_Effacer
    #Button_Quit
EndEnumeration
 
 
; Fonts
Global FontID1
FontID1 = LoadFont(1, "Times New Roman", 24, #PB_Font_Bold)
Global FontID2
FontID2 = LoadFont(2, "Times New Roman", 12)



Global cb
Global cr


Procedure effacer()
    If CreateGadgetList(WindowID())
        SetGadgetText(#String_nom,"")
        SetGadgetText(#String_adresse,"")
        SetGadgetText(#String_ville,"")
        SetGadgetText(#String_cb,"")
        SetGadgetText(#String_cr,"")
        SetGadgetText(#String_totalc,"")
        SetGadgetText(#String_7,"")
        ActivateGadget(#String_nom)
        
    EndIf
    
EndProcedure
Procedure calculer() ;***************************changement ici
    ;Total=#String_cb + #String_cr
    cb=Val(GetGadgetText(#String_cb)) ; val converti du texte en chiffre ; Getgadgettext récupere le texte du gadget. #String_cb n'est que le numéro du gadget ! (son nom) 
    cr=Val(GetGadgetText(#String_cr))
    Total=cb+cr
    
    SetGadgetText(#String_totalc,""+Str(Total)) ; str convertie total (numerique) en text pour pouvoir l'afficher dans le gadget
    
    
    
    
EndProcedure
 
 
Procedure main()
    
    If OpenWindow(#Window_0,0,0,642,482,#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered,"Bon de commande")                                 
        If CreateGadgetList(WindowID())
            TextGadget(#Text_titre, 60, 25, 525, 40,"Bon de commande de magic-shop", #PB_Text_Center)
            SetGadgetFont(#Text_titre, FontID1)
            TextGadget(#Text_nom, 10, 105, 65, 20," Nom :", #PB_Text_Center)
            SetGadgetFont(#Text_nom, FontID2)
            StringGadget(#String_nom, 85, 105, 230, 25, "")
            TextGadget(#Text_adresse, 15, 150, 65, 25, "Adresse :", #PB_Text_Center)
            SetGadgetFont(#Text_adresse, FontID2)
            StringGadget(#String_adresse, 85, 150, 230, 25, "")
            TextGadget(#Text_ville, 5, 195, 60, 25, "Ville :", #PB_Text_Center)
            SetGadgetFont(#Text_ville, FontID2)
            StringGadget(#String_ville, 85, 200, 230, 25, "")
            TextGadget(#Text_carteB, 10, 270, 95, 20, "Carte bleue :", #PB_Text_Center)
            SetGadgetFont(#Text_carteB, FontID2)
            StringGadget(#String_cb, 115, 270, 45, 25, "",#PB_String_Numeric)
            TextGadget(#Text_carteR, 20, 320, 80, 25, "Carte rouge :", #PB_Text_Center)
            SetGadgetFont(#Text_carteR, FontID2)
            StringGadget(#String_cr, 115, 320, 45, 25, "",#PB_String_Numeric)
            TextGadget(#Text_prixU, 370, 100, 90, 20, "prix unitaire :",#PB_Text_Center)
            SetGadgetFont(#Text_prixU, FontID2)
            StringGadget(#String_prixU, 495, 100, 55, 30, "",#PB_String_Numeric)
            TextGadget(#Text_totalc, 365, 170, 115, 20, "Total des cartes :", #PB_Text_Center)
            SetGadgetFont(#Text_totalc, FontID2)
            StringGadget(#String_totalc, 495, 165, 55, 30, "", #PB_String_ReadOnly|#PB_String_Numeric)
            TextGadget(#Text_Total, 360, 225, 65, 25, "Total :", #PB_Text_Center)
            SetGadgetFont(#Text_Total, FontID2)
            StringGadget(#String_7, 495, 220, 55, 30, "", #PB_String_ReadOnly|#PB_String_Numeric)
            ButtonGadget(#Button_Calcule, 30, 395, 135, 40, "Calculer")
            GadgetToolTip(#Button_Calcule, "Calculer la commande ")
            SetGadgetFont(#Button_Calcule, FontID2)
            ButtonGadget(#Button_Effacer, 240, 395, 135, 40, "Effacer")
            GadgetToolTip(#Button_Effacer, " effacer les champs")
            SetGadgetFont(#Button_Effacer, FontID2)
            ButtonGadget(#Button_Quit, 450, 395, 135, 40, "Quitter")
            SetGadgetFont(#Button_Quit, FontID2)
            
        EndIf
    EndIf
EndProcedure
 
 
main()
 
Repeat
    event=WaitWindowEvent()
    Select event
        Case #PB_Event_Gadget
            Select EventGadgetID()
                Case #Button_Calcule:calculer()
                Case #Button_Effacer:effacer()
                Case #Button_Quit:
                    fermer=1
            EndSelect
            
            
        Case #PB_Event_CloseWindow
            fermer=1
    EndSelect
Until fermer=1
End 
Voilà ca devrai marcher, regarde les commentaire pour comprendre.
Vive le temps libre !
Répondre