LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

comparar multiples resultados en CVI ?????

Smiley SurprisedBuen Dia Foro.

Veran quiero compara multimples datos y quiero saver si es posible comparar con una sola sentencia si utilisar multiples "If", ejemplo:

tengo 10 numeros  11,12,13,14,15  y  21, 22, 23, 24 y 25 en una misma lista y tengo dos rutas a donde quiero ir y mi codigo esta de la siguiente forma
____________________________________________________
GetCtrlVal (sap_handle, SAPPNL_DASH,Dash);

    if (strcmp (Dash ,"11")== 0)
       {
        GOTEST_CNET();
        }

    if (strcmp (Dash ,"12")== 0)
       {
        GOTEST_CNET();
        }
    if (strcmp (Dash ,"13")== 0)
       {
        GOTEST_CNET();
        }
    if (strcmp (Dash ,"14")== 0)
       {
        GOTEST_CNET();
        }
    if (strcmp (Dash ,"15")== 0)
       {
        GOTEST_CNET();
        }
////////////////////////////////////////////////////
    if (strcmp (Dash ,"21")== 0)
       {
        GOTEST_WINMB();
        }
    if (strcmp (Dash ,"22")== 0)
       {
        GOTEST_WINMB();
        }
    if (strcmp (Dash ,"23")== 0)
       {
        GOTEST_WINMB();
        }
    if (strcmp (Dash ,"24")== 0)
       {
        GOTEST_WINMB();
        }
    if (strcmp (Dash ,"25")== 0)
       {
        GOTEST_WINMB();
        }


Mi preguntas es. Existe alguna forma de hacer multiples comparaciones con una sola sentencia sin tener que poner multiples If ???????. Smiley Indifferent
0 Kudos
Message 1 of 3
(3,133 Views)

It would make things easier if you converted your "Dash" to a number instead of a string. Then:

    int num;

    GetCtrlVal (sap_handle, SAPPNL_DASH, Dash);
    num = atoi (Dash);
    if (num >= 11 && num <=15) {
        GOTEST_CNET ();
    }
    if (num >= 21 && num <= 25) {
        GOTEST_WINMB ();
    }

Sorry I can only reply in English!

JR

Message 2 of 3
(3,129 Views)
no problem I understand English Smiley Wink

my question was answered satisfactorily  Smiley Happy
Thanks for your fast reply to my question  Smiley Wink
0 Kudos
Message 3 of 3
(3,124 Views)