#include<sys/timeb.h>
#include<sys/types.h>
#include<windows.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<conio.h>
int main(void)
{
char q='A';
int a[4],b[4]={0,0,0,0},i,j=0,m,x=0,y=0;
time_t s_time;
time_t e_time;
srand((int)time(0));
printf("\n\n\n\n\n\n
*********************_zerg*********************\n");
printf("
____
_
_
______
____
____
\n");
printf("
/ ___\\ | | | ||
____| / ___\\
/ ___\\
\n");
printf("
| /
__ | | | || |___
| (___
| (___
\n");
printf("
| | |_ || | | ||
___|
\\___ \\
\\___ \\ \n");
printf("
| \\__/ || \\_/ || |____
____) | ____) |
\n");
printf("
\\____/
\\___/ |______| \\____/
\\____/ \n");
printf("
\n");
printf("
*****************QQ: 453743739*****************\n");
system("COLOR 2f");
Sleep(500);
system("COLOR 3e");
Sleep(500);
system("COLOR 4d");
Sleep(500);
system("COLOR d4");
Sleep(500);
system("COLOR e3");
Sleep(500);
system("COLOR f2");
Sleep(500);
system("COLOR 2f");
system("Pause>nul");
system("cls");
while(j==0)
{
for(i=0;i<=3;i++)
b[i]=rand()%10;
if((b[0]!=b[1])&&(b[0]!=b[2])&&(b[0]!=b[3])&&(b[1]!=b[2])&&(b[1]!=b[3])&&(b[2]!=b[3]))
break;
}
///*DEBUG*/printf("%d %d %d %d\n",b[0],b[1],b[2],b[3]);
while(q!='N')
{
for(m=1;m<=8;m++)
{
printf("S%d: 输入 4 个数字: ",m);
if(m==1)
time(&s_time);
scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]);
x=0;y=0;
for(i=0;i<=3;i++)
for(j=0;j<=3;j++)
{
if((a[i]==b[j])&&(i!=j))
y++;
if((a[i]==b[j])&&(i==j))
x++;
}
for(i=0;i<=18;i++)
printf(" ");
printf("%d A %d B",x,y);
putchar(10);
if(x==4)
m=9;
}
time(&e_time);
system("cls");
printf("共花费时间: %d 秒\n\n",e_time-s_time);
if(x==4)
printf("胜利!再来一次?[Y/N]:");
else
printf("失败!再来一次?[Y/N]:");
getchar();
q=getch();
if(q=='n')
q='N';
system("cls");
}
return 0;
}
//找到头和Sleep就是它了~~~