간단한 가위바위보프로그램을만들었는데 오류가납니다 ㅠㅠ
김애교
컴파일했는데 오류가발생합니다뭐라고 막 뜨기는하는데어디가문젠질몰라서 이렇게 질문을올리네요도와주세요 ㅠㅠ#includestdio.h
#includestdlib.h
#includetime.hint main(void)
{
int p;// player가 낸것
int c;// computer가 낸것
int win=0, lose=0, draw=0;// 이긴횟수, 비긴횟수, 진횟수를 출력하기위한 변수
int count=0;// 총 경기 횟수
printf(가위바위보 게임 입니다. \n);
while(1)
{
printf(선택하세요 -1 : 종료, 0 : 가위, 1 : 바위, 2 : 보 );
scanf(%d, &p);
srand((int)time(NULL)); // 컴퓨터가 낼걸 정하기 위해 랜덤한 수를 설정
c=rand()%3;// 랜덤한 숫자를 각각 가위, 바위, 보로 설정
if(a-1 || a2)
{
printf(error!);
continue;
}
else if
{
switch(a)
{
case 0:
{
if(c==0)
{printf(computer : 가위 , player : 가위 \n비겼습니다! \n);
draw++;}
else if(c==1)
{printf(computer : 바위 , player : 가위 \n졌습니다! \n);
lose++;}
else
{printf(computer : 보 , player : 가위 \n이겼습니다! \n);
win++;}
count++;
break;
}
case 1:
{
if(c==0)
{printf(computer : 가위 , player : 바위 \n이겼습니다! \n);
win++;}
else if(c==1)
{printf(computer : 바위 , player : 바위 \n비겼습니다! \n);
draw++;}
else
{printf(computer : 보 , player : 바위 \n졌습니다! \n);
lose++;}
count++;
break;
}case 2:
{
if(c==0)
{printf(computer : 가위 , player : 보 \n졌습니다! \n);
lose++;}
else if(c==1)
{printf(computer : 바위 , player : 보 \n이겼습니다! \n);
win++;}
else
{printf(computer : 보 , player : 보 \n비겼습니다! \n);
draw++;}
count++;
break;
}
}}
else if(p==-1)
break;
}
printf(게임결과 %d판 (%d승, %d패, %d무) \n, count, win, lose, draw);return 0;
}