#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int ran1, ran2, ran3;
int core1, core2, core3;
int strike, ball;
char choice
do{
printf("##########야구게임#############\n");
printf("1~9사이 임의의 수를 입력한다.\n");
do{
stand(time(NULL));
ran1 = rand()%9+1;
ran2 = rand()%9+1;
ran3 = rand()%9+1;
} while(ran1==ran2 || ran2 == ran3 || ran3==ran1);
do{
printf("숫자를 space로 구분하여 입력하세요.");
scanf("%d %d %d", &core1, &core2, &core3);
strike=ball=0;
if(core1==ran1)
strike++;
if(core2==ran2)
strike++;
if(core3==ran3)
strike++;
if(strike==3){
printf("축하합니다. 성공하셨습니다.\n");
}
else if(strike !=0)
printf("%d 스트라이크\t", strike);
if(core1 !=ran1){
if(core1==ran2)
ball++;
if(core1==ran3)
ball++;
}
if(core2 != ran2){
if(core2==ran1)
ball++;
if(core2==ran3)
ball++;
}
if(core3 != ran3){
if(core3==ran1)
ball++;
if(core3==ran2)
ball++;
}
if(ball==0 && strike ==0)
printf("아웃!\n");
else
printf("%d 볼\n", ball);
}
return 0;
}
실행이 안되거든요 어떻게 건들여야 될지 모르겠습니다
조금만 여러분의 지식을 공유해주세요
stand(time(NULL)); srand(time(NULL));
그건 고쳤는데 처음시작하는 do문에 ;를 입력하라고하는데 어디에 문장을 닫아야 될까요
} return 0; 여기가 do문 블록 끝
근데 do while도 아닌 do는 무슨 의미인가요?
헐 야구겜이라서 부리나케 클릭했는데 ㅋㅋㅋㅋ