Microsoft Small Basic

Microsoft Small Basic est un langage de programmation compilé pour débutants, il fut créé par la société Microsoft en novembre 2008 et est un dérivé du BASIC.
Programmes[modifier | modifier le wikicode]
Voici un programme pour console permettant d'afficher le très célèbre "Hello World" qui signifie "Bonjour le Monde" en anglais :
TextWindow.Write("Hello World")'Afficher Hello World
Et voici un autre programme pour un jeu de Console (Terminal) nommé + ou - :
TextWindow.Write("Bienvenue sur le jeu du + ou -, entrez un nombre : ")'On demande à l'utilisateur d'entrer un nombre
num = TextWindow.ReadNumber()
multi = num + 10 * 2
TextWindow.WriteLine("Entrez un autre nombre, l'ordinateur vous indiquera s'il est plus grand ou plus petit que le nombre mystère : ")
start :'"Start" est une marque (un repère)
num2 = TextWindow.ReadNumber()'L'utilisateur entre un autre nombre
If (num2 > multi) Then
TextWindow.WriteLine("c'est -")'Si le nombre est supérieur à "multi" alors c'est -
TextWindow.Write(" Réessayez : ")
Goto start
EndIf
If (num2 < multi) Then
TextWindow.WriteLine("c'est +")'Si le nombre est inférieur à "multi" alors c'est +
TextWindow.Write(" Réessayez : ")
Goto start
EndIf
If (num2 = multi) Then
TextWindow.WriteLine("c'est exact !")'S'il est égal alors c'est exact
Goto end
EndIf
end :
TextWindow.WriteLine("Le nombre mystère était " + multi + ", aurevoir !")'On ferme le programme avec un aurevoir
Liens externes[modifier | modifier le wikicode]
![]() |
Les langages de l’informatique
|
|