1 #include "stdafx.h" 2 #include "iostream" 3 #include "time.h" //用到time(null)函数,需要此头文件 4 5 using namespace std; 6 7 int a[100000]; 8 int b[100000]; 9 10 11 /*******************12 说明:系统在调用rand(),之前会自动调用srand().系统默认为1.13 对100取余,得到的数在(0~100)之间。14 ********************/15 void initA(int n){16 srand((unsigned)time(NULL));17 for (int i=0;i>n;77 initA(n);78 79 printA(a,n);80 printA(b,n);81 compareNum(a,b,n);82 83 printA(b,n);84 compareNum(a,b,n);85 86 system("pause");87 return 0;88 }