rand()函数
#include "stdio.h" #include "stdlib.h" #include "time.h" int main(){ int i,num; srand(time(0)); for(i=0;i<10;i++){ num=rand()%10+1; printf("%d\n",num); } printf("\n"); system("pause"); return 0; }