JustineFrance
XLDnaute Nouveau
Bonjour à tous, je m'excuse d'avance pour la longue macro ci-dessus. Mais voilà, ça fait quelques temps que je travail sur ce petit jeu de questions, qui malgré tous mes efforts ne fonctionnent toujours pas. Après lecture et relecture, je n'arrive pas à trouver mes erreurs. Merci de votre aide !
Option Explicit
Public numero(1 To 5) As Integer
Public Question(1 To 5) As String
Public reponse(1 To 5) As Integer
Function init_Question()
Question(1) = " 1- Qui occupait ce rôle de sélectionner en 1998 pour les bleus ? " & vbNewLine & vbNewLine & " 1 = aimé jacquet 2 = marc 3 = didier deschamps 4 = eduard pierre"
reponse(1) = 1
Question(2) = " 2- qui a consécutivement été élu ballon d'or en 1983, 1984 et 1985 ? ?" & vbNewLine & vbNewLine & " 1 = zinedine zidane 2 = franck ribery 3 = michel platini 4 = messi "
reponse(2) = 3
Question(3) = " Qui a reçu un carton rouge lors de la finale du mondial 2006 ?" & vbNewLine & vbNewLine & " 1 = zinedine zidane 2 = karim benzema 3 = samir nasri 4 = hugo lloris "
reponse(3) = 1
Question(4) = " 4- En 1984, lors des jeux olympiques d'Été à Los Angeles, quelle médaille la France a-t-elle remporté ?" & vbNewLine & vbNewLine & " 1 = médaille d'ardent 2 = médaille de bronze 3 = médaille d'or 4 = rien"
reponse(4) = 3
Question(5) = " 5- En quelle année a été créé l'équipe de France de football ? " & vbNewLine & vbNewLine & " 1 = 1984 2 = 1910 3 = 1904 4 = 1899 "
reponse(5) = 3
End Function
Function retour_question(num As Integer) As Integer
retour_question = reponse(num)
End Function
Function trouvéNumQestion(numero As Integer) As Integer
Dim i, nbalea, chiffre As Integer
nbalea = Int(Rnd() * 2) + 1
Select Case nbalea
Case 1
chiffre = numero
Case 2
chiffre = numero + 5
Case 3
chiffre = numero + 5
End Select
trouvéNumQestion = chiffre
End Function
Sub questionpourchampion()
Dim rep, point_depart, point_actuel, point As Integer
Dim numeroQ, i As Integer
Dim n As Integer
Call init_Question
point_depart = 0
point_actuel = point_depart
point = 1
For i = 1 To 10
numeroQ = rechercherNumQestion(i)
rep = InputBox(Question(numeroQ))
If rep = reponse(numeroQ) Then
MsgBox (" Bonne réponse : 1 point" & point_actuel & "pt")
Else
point_actuel = point_actuel + 0
MsgBox (" Mauvaise réponse : 0 " & point_actuel & " pt")
End If
End Sub
Etudiant_info
Nouveau venu
Messages: 3
Inscription: 28 Avr 2013, 15:53
Version Excel: 2010
Option Explicit
Public numero(1 To 5) As Integer
Public Question(1 To 5) As String
Public reponse(1 To 5) As Integer
Function init_Question()
Question(1) = " 1- Qui occupait ce rôle de sélectionner en 1998 pour les bleus ? " & vbNewLine & vbNewLine & " 1 = aimé jacquet 2 = marc 3 = didier deschamps 4 = eduard pierre"
reponse(1) = 1
Question(2) = " 2- qui a consécutivement été élu ballon d'or en 1983, 1984 et 1985 ? ?" & vbNewLine & vbNewLine & " 1 = zinedine zidane 2 = franck ribery 3 = michel platini 4 = messi "
reponse(2) = 3
Question(3) = " Qui a reçu un carton rouge lors de la finale du mondial 2006 ?" & vbNewLine & vbNewLine & " 1 = zinedine zidane 2 = karim benzema 3 = samir nasri 4 = hugo lloris "
reponse(3) = 1
Question(4) = " 4- En 1984, lors des jeux olympiques d'Été à Los Angeles, quelle médaille la France a-t-elle remporté ?" & vbNewLine & vbNewLine & " 1 = médaille d'ardent 2 = médaille de bronze 3 = médaille d'or 4 = rien"
reponse(4) = 3
Question(5) = " 5- En quelle année a été créé l'équipe de France de football ? " & vbNewLine & vbNewLine & " 1 = 1984 2 = 1910 3 = 1904 4 = 1899 "
reponse(5) = 3
End Function
Function retour_question(num As Integer) As Integer
retour_question = reponse(num)
End Function
Function trouvéNumQestion(numero As Integer) As Integer
Dim i, nbalea, chiffre As Integer
nbalea = Int(Rnd() * 2) + 1
Select Case nbalea
Case 1
chiffre = numero
Case 2
chiffre = numero + 5
Case 3
chiffre = numero + 5
End Select
trouvéNumQestion = chiffre
End Function
Sub questionpourchampion()
Dim rep, point_depart, point_actuel, point As Integer
Dim numeroQ, i As Integer
Dim n As Integer
Call init_Question
point_depart = 0
point_actuel = point_depart
point = 1
For i = 1 To 10
numeroQ = rechercherNumQestion(i)
rep = InputBox(Question(numeroQ))
If rep = reponse(numeroQ) Then
MsgBox (" Bonne réponse : 1 point" & point_actuel & "pt")
Else
point_actuel = point_actuel + 0
MsgBox (" Mauvaise réponse : 0 " & point_actuel & " pt")
End If
End Sub
Etudiant_info
Nouveau venu
Messages: 3
Inscription: 28 Avr 2013, 15:53
Version Excel: 2010