小编Gle*_*leb的帖子

6031:在Visual Studio 2019中忽略了返回值(getchar())

它不会影响我的代码,但是直到更新Visual Studio之前,我从未见过此类问题。我不知道那是否连接,但是我很困惑为什么会有问题。

#include <iostream>
#include <string>
#include <array>

using namespace std;

int main() {

    const int SIZE = 3;

    array<string, SIZE> names = { "S","A","W" };
    array<string, SIZE>::iterator it;

    cout << "names: \n";
    for (it = names.begin(); it != names.end(); it++)
        cout << *it << endl;


    getchar();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ visual-studio-2019

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

标签 统计

c++ ×1

visual-studio-2019 ×1