小勇者 Pip 打完怪升級了:等級加 1,生命值 hp 加 10。改 hero 裡的這兩樣,顯示的那一行已經寫好了。
Pip: level 5, hp 90
#include <stdio.h>
struct Hero {
char name[20];
int level;
int hp;
};
int main(void) {
struct Hero hero = {"Pip", 4, 80};
// 在這裡寫:hero.level 加 1,hero.hp 加 10
printf("%s: level %d, hp %d\n", hero.name, hero.level, hero.hp);
return 0;
}
寫好了先點「執行」試試示例,沒問題再點「提交」。