#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, cpu;
scanf("%d", &user);
cpu = rand() % 3;
if(user == 0 && cpu == 2 || user == 1 && cpu == 0 || user == 2 && cpu == 1){
printf("이겼습니다.\n");
}else if(user == cpu){
printf("비겼습니다.\n");
}else{
printf("졌습니다.\n");
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: