Batch plus petit plus garnd
Résolu
izissise
Messages postés
160
Date d'inscription
Statut
Membre
Dernière intervention
-
izissise Messages postés 160 Date d'inscription Statut Membre Dernière intervention -
izissise Messages postés 160 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
J'ai fait un bat tout a fait inutile
@echo off
:restart
set n= %random%%%1000
:start
set /p u=Nombre (0,999) ?
If %u% == %n% goto :win
If %u% < %n% goto :p
If %u% > %n% goto :g
:p
echo Plus grand
.
goto :start
:g
echo Plus petit.
goto :start
:win
echo bravo !!
set /p r= recommencer (o/n) ?
if %r% == o goto :restart
Mais > et < ne marche pas comment faire pour "voir" si deux variable sont differente ?
J'ai fait un bat tout a fait inutile
@echo off
:restart
set n= %random%%%1000
:start
set /p u=Nombre (0,999) ?
If %u% == %n% goto :win
If %u% < %n% goto :p
If %u% > %n% goto :g
:p
echo Plus grand
.
goto :start
:g
echo Plus petit.
goto :start
:win
echo bravo !!
set /p r= recommencer (o/n) ?
if %r% == o goto :restart
Mais > et < ne marche pas comment faire pour "voir" si deux variable sont differente ?
A voir également:
- Batch installation id c'est quoi
- Fichier batch - Guide
- Id telephone - Guide
- Installation windows 10 sans compte microsoft - Guide
- Télécharger installation canon lbp6020 gratuit - Forum Imprimante
- Installation chromecast - Guide
7 réponses
ello
dans help if
EQU - égal à
NEQ - différent de
LSS - inférieur à
LEQ - inférieur ou égal à
GTR - supérieur à
GEQ - supérieur ou égal à
dans help if
EQU - égal à
NEQ - différent de
LSS - inférieur à
LEQ - inférieur ou égal à
GTR - supérieur à
GEQ - supérieur ou égal à
Ca ne marche pas : @echo off
:restart
set n= %random%%%1000
:start
set /p u=Nombre (0,999) ?
If %u% == %n% goto :win
If %u% GTR %n% goto :p
If %u% LSS %n% goto :g
:p
echo Plus grand
.
goto :start
:g
echo Plus petit.
goto :start
:win
echo bravo !!
set /p r= recommencer (o/n) ?
if %r% == o goto :restart
Je lais surement mal placer ....
:restart
set n= %random%%%1000
:start
set /p u=Nombre (0,999) ?
If %u% == %n% goto :win
If %u% GTR %n% goto :p
If %u% LSS %n% goto :g
:p
echo Plus grand
.
goto :start
:g
echo Plus petit.
goto :start
:win
echo bravo !!
set /p r= recommencer (o/n) ?
if %r% == o goto :restart
Je lais surement mal placer ....
n'y aurait-il pas une erreur là
C:> set n= %random%%%1000
C:> echo %n%
14383%%1000
essaye avec
set /a n=%random%%1000
C:> set n= %random%%%1000
C:> echo %n%
14383%%1000
essaye avec
set /a n=%random%%1000
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Oui je l'ai corriger ...
If %u% GTR %n% goto :p
If %u% LSS %n% goto :g
sont inverser aussi ... ce qui donne :
@echo off
:restart
set /a z=-1
set /a n= %random%%%1000
:start
set /a z=%z% + 1
set /p u=Nombre (0,999) ?
If %u% == %n% goto :win
If %u% GTR %n% goto :p
If %u% LSS %n% goto :g
:p
echo Plus petit
goto :start
:g
echo Plus grand
goto :start
:win
echo bravo !! en %z% coups !!
set /p r= recommencer (o/n) ?
if %r% == o goto :restart
avec un petit compteur !
If %u% GTR %n% goto :p
If %u% LSS %n% goto :g
sont inverser aussi ... ce qui donne :
@echo off
:restart
set /a z=-1
set /a n= %random%%%1000
:start
set /a z=%z% + 1
set /p u=Nombre (0,999) ?
If %u% == %n% goto :win
If %u% GTR %n% goto :p
If %u% LSS %n% goto :g
:p
echo Plus petit
goto :start
:g
echo Plus grand
goto :start
:win
echo bravo !! en %z% coups !!
set /p r= recommencer (o/n) ?
if %r% == o goto :restart
avec un petit compteur !