rand(),srand()报错。显示未定义标识符。
本来在我的电脑中运行没问题。我觉得运行速度慢,所以拷贝到另外一台电脑上面。然后发现rand,srand报错。显示未定义标识符。
别的没有问题。
这是为什么呢?
谢谢!
2018-11-25 16:39
2018-11-26 00:56
2020-01-28 23:45
2020-02-01 13:24
2020-02-18 19:48
2020-02-18 19:50
程序代码:
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main(){
srand((unsigned)time(NULL));
int n;
n=rand()%100;
cout<<n;
return 0;
}

2020-02-18 19:51
2020-02-18 19:52