我是初学者.求大侠指教.
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int i, x, j, a[20];
j=0;
printf("Ten random numbers from 0 to 99:");
for(i=0; i<20; i++)
{
a[i]=rand()%100;
printf(" %d ", a[i]);
}
printf("Please Input the number you want to know how many times it appeared:\n");
scanf("%d",&x);
for(i=0;i<20;i++)
{if(x==a[i]) ++j;}
printf("It appeared %d times",j);
return 0;
}
VC++运行成功,以后最好是自己想想,多想才有提高