请教一个小问题
各位大虾,我是个C++的爱好者,想请教一下下面的问题:#include<iostream>
#include<ctime>
#include<cstdlib>
using std::cout;
using std::cin;
using std::endl;
using std::rand;
using std::srand;
using std::time;
main(){
cout<<"out 5 numeber between 1 and 49:";
const int number=5;
const int limits=49;
int i=1;
//srand((unsigned int)time(0)); 屏蔽此行时候,运行的结果每次都一样;
for(;i<=number;i++)
{
//srand((unsigned int)time(0));屏蔽此行时候,运行时每次结果都不一样
cout<<static_cast<int>(1+(limits-1)*static_cast<long>(rand())/RAND_MAX)<<" ";
}
cout<<endl;
system("pause");
}
想请大虾分析一下,谢谢