69,382
社区成员
发帖
与我相关
我的任务
分享
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<conio.h>
int main()
{
char c;
int a[4], b[4], i, j, k;
srand((unsigned)time(0));
for (i = 0; i<4; i++)
{
a[i] = rand() % 10;
}
do
{
for (j = 0; j<4; j++)
{
scanf("%d", b[j]);
while (i<4);
{
if (i == j&&a[i] == b[j])
{
i++;
j++;
k++;
}
else
{
i++;
j++;
}
}
printf("%d", k);
scanf("%c", c = getch());
}
} while ((c = getch()) != 27);
return 0;
}