小编ctd*_*015的帖子

使用C++中的用户输入变量声明数组大小.在不同的IDE中有不同的结果?

我需要创建一个程序,用户输入所需的数组大小,然后C++代码创建它,然后允许数据输入.

这适用于Code Blocks IDE,但不适用于Visual Studio Community 2015

当我在CodeBlocks版本13.12中放入以下代码时,它可以工作

#include<iostream>
using namespace std;

int main()
{
    int count;
    cout << "Making the Array" << endl;
    cout << "How many elements in the array " << endl;
    cin >> count;
    int flex_array[count];
    for (int i = 0; i < count; i = i + 1)
    {
        cout << "Enter the " << i << " term " << endl;
        cin >> flex_array[i];
    }

    for (int j = 0; j < count; j …
Run Code Online (Sandbox Code Playgroud)

c++ arrays vector codeblocks visual-studio-2015

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

标签 统计

arrays ×1

c++ ×1

codeblocks ×1

vector ×1

visual-studio-2015 ×1