c baseballgame
- 최초 등록일
- 2001.10.17
- 최종 저작일
- 2001.10
- 2페이지/ C언어
- 가격 1,000원
소개글
^^*
목차
없음
본문내용
#include <stdio.h>
#include <stdlib.h>
void main(){
int a, b, c;
int i, j, k;
int strike=0, ball=0;
int check=0;
randomize();
a= random(10);
b= random(10);
c= random(10);
while(a== b)
b = random(10);
while(c == a)
c = random(10);
while(c == b)
a = random(10);
printf("세수를 입력하세요.\n");
while( check != -1)
{
scanf("%d %d %d", &i, &j, &k);
if(a == i)
strike = strike + 1;
else if(a == j)
ball = ball + 1;
else if(a == k)
ball = ball + 1;
if(b == j)
strike = strike + 1;
else if(b == i)
ball = ball + 1;
else if(b == k)
ball = ball + 1;
if(c == k)
strike = strike + 1;
else if(c == i)
ball = ball + 1;
else if(c == j)
ball = ball + 1;
printf(" %d 스트라이크 , %d 볼\n",strike,ball);
if(strike == 3)
{
check = -1;
printf("축하합니다......3 스트라이크 입니다.");
}
strike = 0;
ball = 0;
}
}
참고 자료
없음