输出100个100以内的随机数(C++)

C++使用随机数:

案例:输出100个100以内的随机数(C++)
实现代码:
#include
#include
#include
using namespace std; 
int main(){
	int a[100],i;
	srand((unsigned)time(NULL));//设置种子
	for(i=0;i<100;i++){
		a[i]=rand()%100;
		cout<
输出结果:
15 53 85 57 31
79 72 81 82 75
88 6 28 74 37
67 82 36 95 47
25 23 20 79 58
69 54 14 27 15
78 22 34 63 51
57 4 55 16 80
16 79 66 31 58
36 68 57 6 10
35 93 26 51 60
29 51 85 63 87
6 98 82 21 17
86 75 92 19 37
46 76 42 45 55
73 63 26 15 94
80 56 56 51 65
41 82 0 31 24
31 9 88 65 63
26 38 6 0 23
请按任意键继续. . .



你可能感兴趣的:(C/C++小实例,C/C++)