Soyez le premier à donner votre avis sur cette source.
Snippet vu 41 330 fois - Téléchargée 26 fois
Sub choix() Dim inputresult As String inputresult = InputBox("calcul de l'hypothenuse: tapez h" & vbCrLf & "calcul d'un coté:tapez c" & vbCrLf & "verification si un triangle est rectangle tapez r", "choisissez une fonction") If inputresult = "h" Then hypo If inputresult = "c" Then coté If inputresult = "r" Then rectangle If inputresult = "a" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "b" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "d" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "e" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "f" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "g" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "i" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "j" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "k" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "l" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "m" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "n" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "o" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "p" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "q" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "s" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "t" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "u" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "v" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "w" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "y" Then MsgBox ("valeur invalide!"): Exit Sub If inputresult = "z" Then MsgBox ("valeur invalide!"): Exit Sub End Sub Sub hypo() Dim valA As Long Dim valB As Long Dim total As Double Dim inputresult As String inputresult = InputBox("premier coté (en mm) :", "dimensions") If Not IsNumeric(inputresult) Then MsgBox ("valeur invalide!"): Exit Sub valA = CLng(inputresult) inputresult = InputBox("deuxiemme coté (en mm) :", "dimensions") If Not IsNumeric(inputresult) Then MsgBox ("valeur invalide!"): Exit Sub valB = CLng(inputresult) total = CLng(Sqr(valA ^ 2 + valB ^ 2)) resultat = MsgBox("l'hypothenuse mesure" & total & " mm") End Sub Sub coté() Dim valA As Long Dim valB As Long Dim total As Double Dim inputresult As String inputresult = InputBox("premier coté (en mm) :", "dimensions") If Not IsNumeric(inputresult) Then MsgBox ("valeur invalide!"): Exit Sub valA = CLng(inputresult) inputresult = InputBox("deuxiemme coté (en mm) :", "dimensions") If Not IsNumeric(inputresult) Then MsgBox ("valeur invalide!"): Exit Sub valB = CLng(inputresult) total = CLng(Sqr(valA ^ 2 - valB ^ 2)) resultat = MsgBox("l'hypothenuse mesure" & total & " mm") End Sub Sub rectangle() Dim valA As Long Dim valB As Long Dim valC As Long Dim total As Double Dim inputresult As String inputresult = InputBox("dimensions du plus grand coté (en mm) :", "dimensions") If Not IsNumeric(inputresult) Then MsgBox ("valeur invalide!"): Exit Sub valA = CLng(inputresult) inputresult = InputBox("dimensions du segond coté (en mm) :", "dimensions") If Not IsNumeric(inputresult) Then MsgBox ("valeur invalide!"): Exit Sub valB = CLng(inputresult) inputresult = InputBox("dimensions du troisiemme coté (en mm) :", "dimensions") If Not IsNumeric(inputresult) Then MsgBox ("valeur invalide!"): Exit Sub valC = CLng(inputresult) total = CLng(Sqr(valB ^ 2 + valC ^ 2)) total = CLng(total) If valA = total Then MsgBox ("le triangle est rectangle") If valA < total Then MsgBox ("le triangle n'est pas rectangle") If valA > total Then MsgBox ("le triangle n'est pas rectangle") End Sub
(pour "tirielle", je pense que tu auras voulu dire "kyrielle".
Ah dur dur le français...
Pour ce qui est du français, essais quand même de faire un petit effort (pas de sms) et de te relire.
pr les else il y avait avant mais il fesait tout planté donc j'ai mis des if
Je ne met pas de note pour l'instant mais éssai de le corriger .
@+,
COrentin
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.