CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

programmation d'un calculatrice

Pseudo supprimé
Pseudo supprimé 12 avril 2016 à 17:34:54

Bonjour à tous
Je suis en DUT info (1er cycle) et on nous demande de programmer une calculatrice sous open office via des macros.
Le problème est que ça plante pour les divisions (msg d'erreur disant que la division est impossible)
Quelqu'un pourrai t'il m'aider en sachant que je l'ai bien déclaré dans mes variables.
Merci

Ketchup_returns
Ketchup_returns
Niveau 10
12 avril 2016 à 18:48:10

Et bien... Poster ton code, on te dira si tu l'as bien fait. :hap:

Pseudo supprimé
Pseudo supprimé 12 avril 2016 à 22:26:39

:d) Dut info :p)
:d) Programmer une calculatrice :(
:d) Sous open office :ouch:

FreddyCouscous
FreddyCouscous
Niveau 10
13 avril 2016 à 08:35:24

Peut être que tu divises par zéro :hap:

Montre le code de la division, peut être que ça aidera plus.

Pseudo supprimé
Pseudo supprimé 13 avril 2016 à 13:24:50

Le 12 avril 2016 à 22:26:39 GangsterBaba a écrit :
:d) Dut info :p)
:d) Programmer une calculatrice :(
:d) Sous open office :ouch:

:rire:

Pseudo supprimé
Pseudo supprimé 13 avril 2016 à 20:17:11

Je le copie ici (et oui,on nous demande de le faire sous open office ou access,ne me demander pas pourquoi!)

sub main Calculatrice
Dim byteoperation As Byte
Dim typeoperation As Byte
Dim nbr1 As Double
Dim nbrvrg As Byte
Dim fctr As Double
Sub CommandButton18_Click()
If label.Caption <> 0 Then
label.Caption = 1 / label.Caption
Else
MsgBox "Division par zéro impossible"
End If
End Sub
Private Sub CommandButton21_Click()
For i = 1 To Len(label)
If Mid(label, i, 1) = "." Then
nbrvrg = nbrvrg + 1
End If
Next i
If nbrvrg = 0 Then
label = label & "."
Else
label = label
End If
nbrvrg = 0
End Sub
Private Sub CommandButton24_Click()
byteoperation = 5
If typeoperation = 1 Then
label = label + nbr1
Else
If typeoperation = 2 Then
label = -1 * label + nbr1
Else
If typeoperation = 3 Then
label = label * nbr1
Else
If typeoperation = 4 Then
If label <> 0 Then
label = nbr1 / label
Else
MsgBox "Division par zéro impossible"
End If
End If
End If
End If
End If
End Sub
Private Sub CommandButton30_Click()
label = 0
End Sub
Private Sub CommandButton6_Click()
If label.Caption >= 0 Then
label.Caption = (label.Caption) ^ 0.5
Else
MsgBox "ce nombre doit être positive"
End If
End Sub
Private Sub fct_Click()
fctr = 1
For i = 1 To label.Caption
fctr = fctr * i
Next i
label.Caption = fctr
End Sub
Private Sub op1_Click()
typeoperation = 1
byteoperation = 1
nbr1 = label.Caption
End Sub
Private Sub op2_Click()
typeoperation = 2
byteoperation = 2
nbr1 = label.Caption
End Sub
Private Sub op3_Click()
typeoperation = 3
byteoperation = 3
nbr1 = label.Caption
End Sub
Private Sub op4_Click()
typeoperation = 4
byteoperation = 4
nbr1 = label.Caption
End Sub
Private Sub commande1_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 1
Else
label.Caption = 1
byteoperation = 0
End If
End Sub
Private Sub commande2_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 2
Else
label.Caption = 2
byteoperation = 0
End If
End Sub
Private Sub commande3_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 3
Else
label.Caption = 3
byteoperation = 0
End If
End Sub
Private Sub commande4_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 4
Else
label.Caption = 4
byteoperation = 0
End If
End Sub
Private Sub commande5_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 5
Else
label.Caption = 5
byteoperation = 0
End If
End Sub
Private Sub commande6_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 6
Else
label.Caption = 6
byteoperation = 0
End If
End Sub
Private Sub commande7_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 7
Else
label.Caption = 7
byteoperation = 0
End If
End Sub
Private Sub commande8_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 8
Else
label.Caption = 8
byteoperation = 0
End If
End Sub
Private Sub commande9_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 9
Else
label.Caption = 9
byteoperation = 0
End If
End Sub
Private Sub commande10_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 0
Else
label.Caption = 0
byteoperation = 0
End If
End Sub
Private Sub ra_Click()
If Len(label.Caption) <> 1 Then
label.Caption = Left(label.Caption, Len(label.Caption) - 1)
Else
label.Caption = 0
End If
End Sub
Private Sub siop_Click()
label.Caption = -label.Caption
End Sub

Chocolayte
Chocolayte
Niveau 73
13 avril 2016 à 20:37:27

Tu devrais reposter ton code avec les balises <code>, sans indentation c'est illisible

Sous forums
  • Aide à l'achat Mac
  • Création de sites web
  • Création de Jeux
  • Linux
  • Programmation
  • Internet
  • Steam Deck
  • Macintosh
  • Hardware
La vidéo du moment