#include <stdio.h>
#include<math.h>
#include <time.h>
#include <windows.h>
gotoxy(int x, int y)
{
COORD pos = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
int main(void)
{
int a[3],b[3],i,c=100,d=100,e,f,s=0,y,u;
srand(time(NULL));
gotoxy(39,25);
printf("청팀카드 ");
gotoxy(38,3);
printf("백팀카드 ");
gotoxy(80,25);
printf("남은돈 ");
printf("%d만원",c);
gotoxy(80,3);
printf("남은돈 ");
printf("%d만원 ",d);
gotoxy(80,5);
printf("얼마를 내시겠습니까?");
printf("\n\n");
gotoxy(80,23);
printf("얼마를 내시겠습니까?");
gotoxy(89,20);
printf("만원");
gotoxy(89,8);
printf("만원");
gotoxy(50,25);
for(i=1; i<=3; i++)
{
a[i]=rand()%10;
printf("%d ",a[i]);
}
gotoxy(50,3);
for(i=1; i<=3; i++)
{
b[i]=rand()%10;
printf("%d ",b[i]);
}
sleep(1);
gotoxy(84,20);
scanf("%d",&f);
sleep(1);
gotoxy(84,8);
scanf("%d",&e);
sleep(1);
gotoxy(84,15);
s=f+e;
printf("합계 %d 만원",s);
sleep(1);
gotoxy(39,20);
printf("청팀카드 = ");
sleep(1);
u=rand()%4;
if(u==0)
{
u=1;
}
printf("%d 번째카드",u);
sleep(1);
gotoxy(39,10);
printf("백팀카드 = ");
sleep(1);
y=rand()%4;
if(y==0)
{
y=1;
}
printf("%d 번째카드",y);
sleep(1);
gotoxy(39,15);
if(a[u]<b[y])
{
printf("백팀승리!!!");
gotoxy(39,16);
printf("백팀이 돈을 가져갑니다");
}
if(b[y]<a[u])
{
printf("청팀승리!!!");
gotoxy(39,16);
printf("청팀이 돈을 가져갑니다");
}
return 0;
}