#include<iostream>
#include<ctime>
#include<cstdlib>
#include<iomanip>
using namespace std;
int main()
{
srand(unsigned(time(NULL)));//解除随机数限制 ,用到 ctime与 cstdlib头文件
for(int i=1; i<=100; i++)
{
cout<<setw(3)<<rand()%100+1<<" ";//控制输出占位为3,用到 iomanip有文件 ,随机数范围为1-100
if(i%10==0)
{
cout<<endl;//每行输出10个
}
}
return 0;
}
输出格式如下: