#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
srand(time(NULL)); //난수 초기화
int r = rand() % 3; //0~2까지 3가지
r = rand() % 3+1; //1~3까지 3가지
printf("%d\n", r);
int user, com;
//0 - 묵, 1 - 찌, 2 - 빠
scanf("%d", &user);
com = rand() % 3;
if (user == 0 && com == 1 || user == 1 && com == 2 || user == 2 && com == 0){
printf("내가 이겼습니다!\n");
}else if (user == com){
printf("비겼습니다.\n");
}else{
printf("내가 졌습니다...\n");
}
switch(com){
case 0:
printf("컴퓨터: 묵\n");
break;
case 1:
printf("컴퓨터: 찌\n");
break;
case 2:
printf("컴퓨터: 빠\n");
break;
}
switch(user){
case 0:
printf("유저: 묵\n");
break;
case 1:
printf("유저: 찌\n");
break;
case 2:
printf("유저: 빠\n");
break;
}
int num;
scanf("%d", &num);
if (num % 2 == 0){
printf("짝수입니다.");
}else {
printf("홀수입니다.");
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: