Untitled

 avatar
unknown
plain_text
2 years ago
875 B
1
Indexable
while ( input[i] != '\0' ) {

//Contar el tipo de personaje
        if ( input[i] == 'D') {
               count_demons++;
               flag = 1;
               i++;
        }
        else if ( input[i] == 'H') {
                count_humans++;
                flag = 2;
                i++;
        }


        else if ( input[i] >= 'a' && input[i] <= 'z' && flag == 1 ) {
            personaje.moons[count_demons].name_M[j] = input[i];
            j++;
            i++;
        }
        personaje.moons[count_demons].name_M[j + 1] = '\0';

 

        if ( input[i] >= 'a' && input[i] <= 'z' && flag == 2 ) {
            personaje.demonslayers[count_humans].name_DS[j] = input[i];
            j++;
            i++;
        }
        personaje.moons[count_demons].name_M[1] = '\0';
        personaje.demonslayers[count_humans].name_DS[j + 1] = '\0';

 

        

 

    }
Editor is loading...