Advertisement
Scorpionh

Tp2 semaine 1

Apr 7th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.18 KB | None | 0 0
  1. Module Module1
  2.  
  3.     Sub Main()
  4.         Dim myname As String
  5.         Dim nom(25) As String
  6.         Dim cmp As Integer = 0
  7.         Dim fin As Integer = 0
  8.         Dim reponse As MsgBoxResult
  9.         Dim motLePlusPetitDejaVu As String
  10.         Do
  11.             ' Entree des noms
  12.             myname = InputBox("Entrer un nom", "InputBox Demo")
  13.             nom(cmp) = myname
  14.             cmp = cmp + 1
  15.         Loop Until myname = "*"
  16.  
  17.         motLePlusPetitDejaVu = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
  18.         For compteur As Integer = 0 To cmp - 2
  19.             If String.Compare(motLePlusPetitDejaVu, nom(compteur)) > 0 Then
  20.                 motLePlusPetitDejaVu = nom(compteur)
  21.                 reponse = MsgBox("Est-ce le plus petit nom " & nom(compteur), MsgBoxStyle.YesNo, "Classement du plus petit")
  22.                 If reponse = MsgBoxResult.Yes Then
  23.                     MsgBox("Le nom le plus petit est " & nom(compteur), MsgBoxStyle.OkOnly, "Classement du plus petit")
  24.                     Exit Sub
  25.                 End If
  26.             End If
  27.         Next
  28.         MsgBox("Il n'y a pas de plus petit validé")
  29.  
  30.  
  31.     End Sub
  32.  
  33. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement