产生随机数//NULL大写,rand()在cstdlib,不在cmath

#include <cstdlib>
#include <time.h>
#include <iostream>
using namespace std;
//#include <cmath> 
int main()
{
    int i=0;
    srand(time(NULL));//Initialize random number generator
    while (i!=100) 
    {
        cout<<rand()<<endl;
        i++;
    }    
    cin.get();
    return 0;   
}  


 

posted @ 2011-08-31 09:26  gitran  阅读(206)  评论(0编辑  收藏  举报