#include <stdio.h>
int main() {
int hungry = 5, happy = 5, health = 5;
while(1){
printf("[내 펫 상태]\n");
printf("배고픔: %d, 행복함: %d, 체력: %d\n", hungry, happy, health);
printf("시작! 1: 밥주기 2: 놀아주기 3: 쉬기 4: 종료\n");
int choice, end = 0;
scanf("%d", &choice);
switch(choice){
case 1:
hungry += 2;
break;
case 2:
happy += 2;
break;
case 3:
health += 2;
break;
case 4:
end = 1;
break;
}
hungry--;
happy--;
health--;
if(hungry >= 10){
hungry = 10;
}
if(happy >= 10){
happy = 10;
}
if(health >= 10){
health = 10;
}
if(health <= 2 || hungry <= 2 || happy <= 2){
printf(" /|__|\\ \n");
printf("(=ㅠ_ㅠ=) \n");
printf(" |v v| \n");
}else{
printf(" /|__|\\ \n");
printf("(=^o ^=) \n");
printf(" |v v| \n");
}
if (end == 1){
break;
}else if (hungry == 0 || happy == 0 || health == 0){
break;
}
}
printf("Game Over!");
}
To embed this project on your website, copy the following code and paste it into your website's HTML: