Accueil > > > CONVERTISEUR BINAIRE, HEXA, OCTAL ET DECIMAL
CONVERTISEUR BINAIRE, HEXA, OCTAL ET DECIMAL
Information sur la source
Description
Ce programme date de longtemps mais j'étais tanner de mettre des commentaires sur des sources quand je n'avais meme pas moi même poster une source alors ça va être a mon tour de me faire jugé :P Je l'ai fait durant mon cour de binaire et hexa a l'école... c'est pour sa qu'il s'apelle Binaire2Hexa mais je l'ai évoluer avec le temps Je ne connaissais pas la fonction Hex() et les autres s'il y en a alors j'ai tous fait a la main. Donnez moi des commentaires svp... Et je suis désoler si je n'ai pas mis de commentaire dans ma source car j'aime pas ben ben sa en mettre!!! Même si je sais que c'est important.
Source
- 'Exemple de code dans mon programme
-
- Private Sub Bo_Binaire2Hexa_Click()
- Et_Hexa.Caption = ""
- Var_Len = Len(Zt_Binaire.Text)
- Var_OK = Var_Len / 4
- If Right(Var_OK, 2) = "25" Then Zt_Binaire.Text = "000" + Zt_Binaire.Text
- If Right(Var_OK, 2) = ",5" Then Zt_Binaire.Text = "00" + Zt_Binaire.Text
- If Right(Var_OK, 2) = "75" Then Zt_Binaire.Text = "0" + Zt_Binaire.Text
- Var_Len = Len(Zt_Binaire.Text)
- Do Until Var_Fois >= (Var_Len / 4)
- Var_Fois = Var_Fois + 1
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0000" Then Et_Hexa.Caption = Et_Hexa.Caption + "0"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0001" Then Et_Hexa.Caption = Et_Hexa.Caption + "1"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0010" Then Et_Hexa.Caption = Et_Hexa.Caption + "2"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0011" Then Et_Hexa.Caption = Et_Hexa.Caption + "3"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0100" Then Et_Hexa.Caption = Et_Hexa.Caption + "4"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0101" Then Et_Hexa.Caption = Et_Hexa.Caption + "5"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0110" Then Et_Hexa.Caption = Et_Hexa.Caption + "6"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0111" Then Et_Hexa.Caption = Et_Hexa.Caption + "7"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1000" Then Et_Hexa.Caption = Et_Hexa.Caption + "8"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1001" Then Et_Hexa.Caption = Et_Hexa.Caption + "9"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1010" Then Et_Hexa.Caption = Et_Hexa.Caption + "A"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1011" Then Et_Hexa.Caption = Et_Hexa.Caption + "B"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1100" Then Et_Hexa.Caption = Et_Hexa.Caption + "C"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1101" Then Et_Hexa.Caption = Et_Hexa.Caption + "D"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1110" Then Et_Hexa.Caption = Et_Hexa.Caption + "E"
- If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1111" Then Et_Hexa.Caption = Et_Hexa.Caption + "F"
- Loop
- Clipboard.SetText Et_Hexa.Caption 'Met la réponse dans le presse-papier
- End Sub
-
- 'Apres modification :
-
- Private Sub Bo_Binaire2Hexa_Click()
- Et_Hexa.Caption = ""
- Var_Len = Len(Zt_Binaire.Text)
- Var_OK = Var_Len / 4
- Select Case Right(Var_OK, 2)
- Case "25"
- Zt_Binaire.Text = "000" + Zt_Binaire.Text
- Case ",5"
- Zt_Binaire.Text = "00" + Zt_Binaire.Text
- Case "75"
- Zt_Binaire.Text = "0" + Zt_Binaire.Text
- End Select
- Var_Len = Len(Zt_Binaire.Text)
- Do Until Var_Fois >= (Var_Len / 4)
- Var_Fois = Var_Fois + 1
- Select Case Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4)
- Case "0000"
- Et_Hexa.Caption = Et_Hexa.Caption + "0"
- Case "0001"
- Et_Hexa.Caption = Et_Hexa.Caption + "1"
- Case "0010"
- Et_Hexa.Caption = Et_Hexa.Caption + "2"
- Case "0011"
- Et_Hexa.Caption = Et_Hexa.Caption + "3"
- Case "0100"
- Et_Hexa.Caption = Et_Hexa.Caption + "4"
- Case "0101"
- Et_Hexa.Caption = Et_Hexa.Caption + "5"
- Case "0110"
- Et_Hexa.Caption = Et_Hexa.Caption + "6"
- Case "0111"
- Et_Hexa.Caption = Et_Hexa.Caption + "7"
- Case "1000"
- Et_Hexa.Caption = Et_Hexa.Caption + "8"
- Case "1001"
- Et_Hexa.Caption = Et_Hexa.Caption + "9"
- Case "1010"
- Et_Hexa.Caption = Et_Hexa.Caption + "A"
- Case "1011"
- Et_Hexa.Caption = Et_Hexa.Caption + "B"
- Case "1100"
- Et_Hexa.Caption = Et_Hexa.Caption + "C"
- Case "1101"
- Et_Hexa.Caption = Et_Hexa.Caption + "D"
- Case "1110"
- Et_Hexa.Caption = Et_Hexa.Caption + "E"
- Case "1111"
- Et_Hexa.Caption = Et_Hexa.Caption + "F"
- End Select
- Loop
- Clipboard.SetText Et_Hexa.Caption
- End Sub
-
'Exemple de code dans mon programme
Private Sub Bo_Binaire2Hexa_Click()
Et_Hexa.Caption = ""
Var_Len = Len(Zt_Binaire.Text)
Var_OK = Var_Len / 4
If Right(Var_OK, 2) = "25" Then Zt_Binaire.Text = "000" + Zt_Binaire.Text
If Right(Var_OK, 2) = ",5" Then Zt_Binaire.Text = "00" + Zt_Binaire.Text
If Right(Var_OK, 2) = "75" Then Zt_Binaire.Text = "0" + Zt_Binaire.Text
Var_Len = Len(Zt_Binaire.Text)
Do Until Var_Fois >= (Var_Len / 4)
Var_Fois = Var_Fois + 1
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0000" Then Et_Hexa.Caption = Et_Hexa.Caption + "0"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0001" Then Et_Hexa.Caption = Et_Hexa.Caption + "1"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0010" Then Et_Hexa.Caption = Et_Hexa.Caption + "2"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0011" Then Et_Hexa.Caption = Et_Hexa.Caption + "3"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0100" Then Et_Hexa.Caption = Et_Hexa.Caption + "4"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0101" Then Et_Hexa.Caption = Et_Hexa.Caption + "5"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0110" Then Et_Hexa.Caption = Et_Hexa.Caption + "6"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "0111" Then Et_Hexa.Caption = Et_Hexa.Caption + "7"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1000" Then Et_Hexa.Caption = Et_Hexa.Caption + "8"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1001" Then Et_Hexa.Caption = Et_Hexa.Caption + "9"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1010" Then Et_Hexa.Caption = Et_Hexa.Caption + "A"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1011" Then Et_Hexa.Caption = Et_Hexa.Caption + "B"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1100" Then Et_Hexa.Caption = Et_Hexa.Caption + "C"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1101" Then Et_Hexa.Caption = Et_Hexa.Caption + "D"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1110" Then Et_Hexa.Caption = Et_Hexa.Caption + "E"
If Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4) = "1111" Then Et_Hexa.Caption = Et_Hexa.Caption + "F"
Loop
Clipboard.SetText Et_Hexa.Caption 'Met la réponse dans le presse-papier
End Sub
'Apres modification :
Private Sub Bo_Binaire2Hexa_Click()
Et_Hexa.Caption = ""
Var_Len = Len(Zt_Binaire.Text)
Var_OK = Var_Len / 4
Select Case Right(Var_OK, 2)
Case "25"
Zt_Binaire.Text = "000" + Zt_Binaire.Text
Case ",5"
Zt_Binaire.Text = "00" + Zt_Binaire.Text
Case "75"
Zt_Binaire.Text = "0" + Zt_Binaire.Text
End Select
Var_Len = Len(Zt_Binaire.Text)
Do Until Var_Fois >= (Var_Len / 4)
Var_Fois = Var_Fois + 1
Select Case Right(Left(Zt_Binaire.Text, (Var_Fois * 4)), 4)
Case "0000"
Et_Hexa.Caption = Et_Hexa.Caption + "0"
Case "0001"
Et_Hexa.Caption = Et_Hexa.Caption + "1"
Case "0010"
Et_Hexa.Caption = Et_Hexa.Caption + "2"
Case "0011"
Et_Hexa.Caption = Et_Hexa.Caption + "3"
Case "0100"
Et_Hexa.Caption = Et_Hexa.Caption + "4"
Case "0101"
Et_Hexa.Caption = Et_Hexa.Caption + "5"
Case "0110"
Et_Hexa.Caption = Et_Hexa.Caption + "6"
Case "0111"
Et_Hexa.Caption = Et_Hexa.Caption + "7"
Case "1000"
Et_Hexa.Caption = Et_Hexa.Caption + "8"
Case "1001"
Et_Hexa.Caption = Et_Hexa.Caption + "9"
Case "1010"
Et_Hexa.Caption = Et_Hexa.Caption + "A"
Case "1011"
Et_Hexa.Caption = Et_Hexa.Caption + "B"
Case "1100"
Et_Hexa.Caption = Et_Hexa.Caption + "C"
Case "1101"
Et_Hexa.Caption = Et_Hexa.Caption + "D"
Case "1110"
Et_Hexa.Caption = Et_Hexa.Caption + "E"
Case "1111"
Et_Hexa.Caption = Et_Hexa.Caption + "F"
End Select
Loop
Clipboard.SetText Et_Hexa.Caption
End Sub
Historique
- 27 avril 2005 23:29:25 :
- faute d'orthographe
- 28 avril 2005 18:38:40 :
- Amélioration du code (Changer les IF pour des Select Case (Merci ticomic) , nouveau screenshot
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
SESSION SILVERLIGHT 5 3D : SLIDES ET DEMOSSESSION SILVERLIGHT 5 3D : SLIDES ET DEMOS par Groc
Durant les techdays, j'ai eu le plaisir d'animer une session sur Silverlight 5 et la 3D avec Simon Ferquel. Comme promis, voici nos slides et mes démos (celles avec le viper BSG) ici et là. Pour mémoire, les démos utilisent toutes le viper BSG...
Cliquez pour lire la suite de l'article par Groc [TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES[TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES par gpommier
Suite à la session que j'ai présenté sur WebMatrix 2, vous pouvez trouver les slides ici, ainsi que les démos en packages nuget : démos1 et démos2 J'en profite pour remercier chaleureusement tous ceux qui sont venus très nombreux à cette sess...
Cliquez pour lire la suite de l'article par gpommier [SHAREPOINT] LES SESSIONS TECHDAYS 2012.[SHAREPOINT] LES SESSIONS TECHDAYS 2012. par Patrick Guimonet
Voici donc pour ceux qui n'ont pas pu venir, ou ceux qui n'ont pas pu toutes les suivre la liste des sessions SharePoint aux TechDays 2012, que je mettrais à jour dès que les liens des vidéo seront disponibles. Ou ici : http...
Cliquez pour lire la suite de l'article par Patrick Guimonet TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3 par ROMELARD Fabrice
Speaker: Bernard Ourghanlian Cette session est comme chaque jour transmise en live par BrainSonic, et j'ai donc suivi cette troisième pleinière par ce moyen sur mon iPad . Elle est dédiée comme chaque année à la mise en perspective de l'é...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE !MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE ! par Vko
Hier durant une session dédiée aux Techdays 2012, j'ai eu le plaisir d'annoncer la sortie de la Béta 2 de Mishra Reader. C'est quoi ? Pour les utilisateurs, c'est une vraie expérience de lecture de flux RSS sur Windows. Rien à voir avec les produit...
Cliquez pour lire la suite de l'article par Vko
Logiciels
Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning
|