This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include<bits/stdc++.h>
usingnamespacestd;
/*
用随机函数产生100个[0,99]范围内的随机整数,
统计个位上的数字分别为0,1,2,3,4,5,6,7,8,9的数的个数并打印出来
*/
#define MAX 101
voidinput(intnum[]){
inti;
srand((unsigned)time(NULL));
for(i=1;i<MAX;i++)
num[i]=rand()%100;
}
voidoutput(intnum[]){
inti;
for(i=1;i<MAX;i++){
printf("%5d",num[i]);
if(0==i%10)
printf("\n");
}
printf("\n");
}
voidcal_num(intnum[],intcount[]){
inti,mod;
for(i=1;i<MAX;i++){
mod=num[i]%10;
count[mod]++;
}
}
intmain(){
intnum[MAX];
inti,count[10];
memset(count,0,10*sizeof(int));/* initial count[] to 0 */