怎么在C++中产生随机数?
RT
#include <iostream>
using namespace std;
#include <ctime>
#include <cstdlib>
int main()
{
int t;
srand(time(0)); //seed
t = rand() % 100 + 1; // random number 1-100
cout << t << endl;
return 0;
}