无法解决的功能'srand'?(我正在使用 Ubuntu OS 和 Eclipse)
Function 'srand' could not be solve? (i'm using Ubuntu OS and Eclipse)
这是我第一次使用Eclipse进行C++编程,我遇到了一个问题。我已经包含了"time.h",但错误(函数"srand"无法解决)仍然出现。请帮帮我!非常感谢
#include "iostream"
#include "time.h"
using namespace std;
#define MAX 100
void InputArray(int a[],int n)
{
srand((unsigned)time(NULL)); //error here Function 'srand' could not be solved
a[0]=rand()%10; //and here
for(int i=1; i<n; i++)
a[i]=a[i-1] + rand()%10 + 1;
}
int main() {
int a[MAX], n;
InputArray(a,n);
return 0;
}
您忘记了
#include <stdlib.h>
相关文章:
- 在Ubuntu 16.04上安装Cilk时出现问题
- 如何在Ubuntu中使用cmake设置qt4
- 链接阶段在Ubuntu上失败,但在MacOS上失败
- 无法将 GLFW 库与 Ubuntu 18.04 上的头文件链接
- 无法在Ubuntu上将共享库与Eclipse链接
- "ostream &os"有什么用?
- libprotobuf 检查在 Mac OS 上执行程序时失败
- 树莓上的 Libtorch 无法加载 pt 文件,但在 ubuntu 上工作
- C++读取用户输入而不按回车键(Mac OS X),与Turbo Pascal中的读取键相同
- 如何在 MAC OS c/c++ 中阻止 USB 存储设备
- 在 Ubuntu(linux OS)中将一个巨大的文件读入C++向量
- 在 Ubuntu OS 中的 Matlab 2017a 上切换编译器
- CMake 在 Linux (Ubuntu) 上使用"target_include_directories"的方式与 OS X 不同
- 在Ubuntu环境中部署在Mac OS上开发的C 应用程序
- 在OS Ubuntu中运行GDB时,如何导出阀门值为文本文件
- 可以在Ubuntu中进行编译,但不能在Mac OS X中进行编译
- Ubuntu OS中的文件表
- 无法解决的功能'srand'?(我正在使用 Ubuntu OS 和 Eclipse)
- ubuntu OS, g++, cannot find -lplplot
- Ubuntu和OS-X之间的头文件兼容性