Kodewick
Empieza a aprender →
Inicial←→0 / 70

Sube de nivel

#057Inicialhero.level + 13 min

El pequeño héroe Pip venció a un monstruo y sube de nivel: level sube 1 y hp sube 10. Cambia esos dos en hero; la línea que los muestra ya está escrita.

Debería mostrar
Pip: level 5, hp 90
main.c
#include <stdio.h>

struct Hero {
    char name[20];
    int level;
    int hp;
};

int main(void) {
    struct Hero hero = {"Pip", 4, 80};
    // tu código aquí: suma 1 a hero.level y 10 a hero.hp
    printf("%s: level %d, hp %d\n", hero.name, hero.level, hero.hp);
    return 0;
}
Ctrl + Enter también ejecuta
Resultado

Ejecutar prueba los ejemplos. Cuando salgan bien, Enviar.