c語(yǔ)言生成1~100隨機(jī)數(shù) C語(yǔ)言中如何生成一個(gè)隨機(jī)數(shù)組?
C語(yǔ)言中如何生成一個(gè)隨機(jī)數(shù)組?代碼:#include#include#include{srand((unsigned)time(null))int a[100]printf(”立即初始化100個(gè)數(shù)組的
C語(yǔ)言中如何生成一個(gè)隨機(jī)數(shù)組?
代碼:#include
#include
#include
{
srand((unsigned)time(null))
int a[100
]printf(”立即初始化100個(gè)數(shù)組的數(shù)目(范圍為0~100)。n“”
for(int I=0I
{
a[I]=rand() 1
printf(“m”,a[I])
if(I ==0&;I!=0)
printf(“ ”n“)
!getchar()]}]圖: