Untitled

Anonymous
plain_text
12/29/2022 9:45 AM
1.1 KB
16
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...