小编Con*_*uck的帖子

没有运算符">>"匹配这些操作数

我正在编写一个函数定义,让用户输入数组的元素但是得到错误 cin >> a[index];

void show(const double a[], unsigned els) {
    size_t index = 0;

    for (index = 0; index < els; index++) {
        cin >> a[index];
        }

    for (index = 0; index < els; index++) {
        if (a[index] == a[0]) {
            cout << "{" << a[index] << ",";
        }
        else if (a[index] == a[els - 1]) {
            cout << a[index] << "}";
        }
        else { cout << a[index] << ","; }
    }
    cout << endl;
}
Run Code Online (Sandbox Code Playgroud)

c++ visual-studio

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

标签 统计

c++ ×1

visual-studio ×1