/* ¼¼±×¸ÕÆ® ¿À·ù°¡ ¶ß´Âµ¥ ¾Æ¹«·¡µµ NUM ÇÔ¼ö°¡ ¹®Á¦ÀÌ°Í °°½À´Ï´Ù.
³¼ö ¹ß»ýÀ» ÇÏ´Â°Ô Ã³À½ Çغ¸´Â °Å¶ó ¾î¶»°Ô ÇÏ´ÂÁö À߸𸣰ڱº¿ä. */
-bash-2.05b$ cat Num3er.c
#include <stdio.h>
#include <stdlib.h>
// Setting NUM Function Chapter
void NUM();
main()
{
// 'T' SET Chapter
unsigned int a, b, c;
unsigned int x, y, z;
int cnt, out, stk, ball;
int *pa, *pb, *pc;
printf("NUM3ER BA5EBALL 6AME\n");
// Call NUM Function Chapter
NUM();
// Random Number Set Chapter
a= *pa;
b= *pb;
c= *pc;
// Input FOR Chapter
for(cnt=0;cnt<10;cnt++){
// Input Num3er Chapter
printf("Input Num3er....,3 more\n");
scanf("%d\n", &x);
printf("Input Num3er.....2 more\n");
scanf("%d\n", &y);
printf("Input Num3er.....1 more\n");
scanf("%d\n", &z);
printf("INPUT %d %d %d\n", x, y, z);
// Num3er Check Chapter
stk=0;
ball=0;
if(x==a)
stk+=1;
else if(x==b)
ball+=1;
else if(x==c)
ball+=1;
if(y==b)
stk+=1;
else if(y==a)
ball+=1;
else if(y==c)
ball+=1;
if(z==c)
stk+=1;
else if(z==a)
ball+=1;
else if(z==b)
ball+=1;
printf("%d Strike\n", stk);
printf("%d Ball\n", ball);
if(x==a && y==b && z==c){
printf("Swing!! Home...RUN!!!!!\n");
exit(0);
}
else{
life=10-cnt;
printf("%d more.....\n", life);
if(cnt>9){
printf("OUT!!!\n");
exit(0);
}
}
}
}
// Set NUM Function Chpater
void NUM(){
int *pa, *pb, *pc;
srand((unsigned)time(NULL));
*pa = rand()%1000;
*pb = rand()%1000;
*pc = rand()%1000;
return;
}
|