杨开来吧 关注:2贴子:40
  • 0回复贴,共1

C++怎么产生随机数

只看楼主收藏回复

#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main()
{
srand((unsigned)time(NULL));
for(int i = 0; i < 10;i++ )
cout << rand() << '\t';
cout << endl;
return 0;
}


IP属地:上海1楼2014-05-12 14:56回复