Comment retourner un élément d'un tableau dans le Lot?

J'ai deux éléments dans mon tableau liste dans mon programme. Comment puis-je assigner une variable à l'égalité de l'un des éléments?

Voici le code:

@echo off
setlocal enabledelayedexpansion
set /p string=
for /l %%a in (0,1,1000) do if not "!String:~%%a,1!"=="" set /a length=%%a+1
set i=0
:input
set str=%string:~0,1%
if "%str%"=="M" set array[i]=1000
if "%str%"=="D" set array[i]=500
if "%str%"=="C" set array[i]=100
if "%str%"=="L" set array[i]=50
if "%str%"=="X" set array[i]=10
if "%str%"=="I" set array[i]=1
set string=%string:~1%
set /a i=i+1
if %i%==%length% goto logic
goto input
:logic

J'ai vraiment bien qu'il y avait un moyen standard de le faire.

  • le code s'il vous plaît, je n'ai aucune idée de comment votre tableau ou quelque chose est mis en place.
  • Quelle langue utilisez-vous? Montrer un peu de code!
InformationsquelleAutor Ivan Spajic | 2012-05-29