Advertisement
Hugo7

Générateur de suite binaire

Aug 24th, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.36 KB | None | 0 0
  1. :: hexa : 000000 = 0
  2. ::        000001 = 1
  3. ::        000010 = 2
  4. ::        000011 = 3
  5. ::           etc
  6. :: %s1% est le premier bit en partant de la gauche etc.
  7.  
  8. :: Génère un fichier bin.log
  9.  
  10. :: (c) Hugo7
  11.  
  12. @echo off
  13. cls
  14. setlocal enabledelayedexpansion
  15. set /p str=Entrez 6 bits ^(la ou on veut commencer, sinon mettre 000000^) ^>
  16. for /L %%A in () do (
  17. set s1=!str:~0,1!
  18. set s2=!str:~1,1!
  19. set s3=!str:~2,1!
  20. set s4=!str:~3,1!
  21. set s5=!str:~4,1!
  22. set s6=!str:~5,1!
  23. title !str! = !s1! !s2! !s3! !s4! !s5! !s6!
  24. if !s6!==0 (
  25.     set s6=1
  26. ) else if !s6!==1 if !s5!==0 (
  27.    :: quand 000001 alors 000010
  28.     set s5=1
  29.     set s6=0
  30. ) else if !s6!==1 if !s5!==1 if !s4!==0 (
  31.    :: quand 000011 alors 000100
  32.     set s4=1
  33.     set s6=0
  34.     set s5=0
  35. ) else if !s6!==1 if !s5!==1 if !s4!==1 if !s3!==0 (
  36.    :: quand 000111 alors 001000
  37.     set s3=1
  38.     set s6=0
  39.     set s5=0
  40.     set s4=0
  41. ) else if !s6!==1 if !s5!==1 if !s4!==1 if !s3!==1 if !s2!==0 (
  42.    :: quand 001111 alors 010000
  43.     set s2=1
  44.     set s6=0
  45.     set s5=0
  46.     set s4=0
  47.     set s3=0
  48. ) else if !s6!==1 if !s5!==1 if !s4!==1 if !s3!==1 if !s2!==1 if !s1!==0 (
  49.    :: quand 011111 alors 100000
  50.     set s1=1
  51.     set s6=0
  52.     set s5=0
  53.     set s4=0
  54.     set s3=0
  55.     set s2=0
  56. )
  57. set str=!s1!!s2!!s3!!s4!!s5!!s6!
  58. echo !str! >>bin.log
  59. if !str!==111111 (
  60.     echo fini
  61.     pause
  62.     exit
  63. )
  64. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement