#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main() {
srand((unsigned)time(NULL));
int i, strike = 0, ball = 0;
int arr[3] = { 0 };
int answer[3];
for (i = 0; i < 3; i++) {
arr[i] = 1 + rand() % 10;
}
while (arr[0] == arr[1] || arr[1] == arr[2] || arr[0] == arr[2]) {
for (i = 0; i < 3; i++) {
arr[i] = 1 + rand() % 10;
}
}
do {
strike =0, ball = 0;
printf("정수 3개 입력 (ex 1 2 3)\t\t");
scanf_s("%d %d %d", &answer[0], &answer[1], &answer[2]);
for (i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (arr[i] == answer[j])
ball++;
}
if (arr[i] == answer[i])
strike++;
}
printf("스트라이크 %d 볼 %d\n", strike, ball - strike);
} while (strike != 3);
printf("3 STRIKE입니다.!\n");
for (i = 0; i < 3; i++)
printf("%d ", arr[i]);
}