짱짱이ㅣㅣㅣㅣㅣㅣㅣㅣㅣ
C
#include <stdio.h>
int main() {
int hungry = 5, happy = 5, health = 5;
char name[10];
scanf("%s", name);
while(1){
for(int i=0; i<10; i++){
printf("%c", name[i]);
}
printf("[펫 상태]\n");
printf("배고픔: %d,행복함: %d, 체력:%d\n",hungry,happy,health);
printf("시작! 1: 밥 주기 2: 놀아주기 3: 쉬기 4: 종료\n\n");
int choice;
scanf("%d", &choice);
if (choice == 1){
hungry += 2;
}else if (choice == 2){
happy += 2;
}else if(choice == 3){
health += 2;
}else if(choice == 4){
break;
}
hungry--;
happy--;
health--;
if(hungry <= 2 || happy <= 2 || health <= 2){
printf(" /|_|\\ (🍕)\n");
printf(" (=TㅗT=)\n");
printf(" <| . |>\n");
}else{
printf(" /|_|\\\n");
printf("(=^0^=)\n");
printf("~| . |~");
}
if(hungry >= 10){
hungry = 10;
}
if(happy >= 10){
happy = 10;
}
if(health >= 10){
health =10;
}
if(hungry == 0 || happy ==0 || health == 0){
printf("\nGame Over!");
break;
}
}
}
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.