我刚刚在C++中编写了以下代码,但是我有一个问题:生成的随机数总是相同的..!! 这是我的代码和截图:
#include <iostream>
using namespace std;
int main() {
cout << "I got a number in my mind... can you guess it?" << endl;
int random;
random = rand() % 20 + 1;
cout << random << endl;
system("pause");
return 0;
}
截图: http://tinyurl.com/n49hn3j