小编J. *_*ent的帖子

如何修复编译器警告 C6386 和 C6385?

对于我正在编写的程序,我需要创建一个具有用户定义大小的数组,以及 -15 到 15 之间的随机值。因此,我将 srand 与动态数组转换一起使用。这是我的完整代码如下:

#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int main()
{
    //initialize variables
    double minValue;
    double maxValue;
    double firstQuartile;
    double thirdQuartile;
    double skewness;

    int size;
    std::cout << "Please enter the size of the data set: ";                 //get data set size from user
    std::cin >> size;
    int* dataSet = new int[size];                                                           
    cout << endl << "These are the randomly generated values: ";

    srand(static_cast<unsigned int>(time(NULL)));

    int i = size;
    for (int x = 0; …
Run Code Online (Sandbox Code Playgroud)

c++ arrays random srand compiler-warnings

3
推荐指数
1
解决办法
762
查看次数

标签 统计

arrays ×1

c++ ×1

compiler-warnings ×1

random ×1

srand ×1