整個項目很長,所以我剛纔包含了相關的行。沒有操作符「<=」匹配這些操作數
#include "stdafx.h"
#include <iostream>
#include <string>
string list[50][50];
string a, b;
for (int i = 0; i<50; i++) {
cout << "Insert a" << endl;
cin >> a;
cout << "Insert b" << endl;
cin >> b;
list[i][i] = {
{a},
{b}
};
}
賦值運算符「=」是唯一有錯誤的。錯誤是:「無運算符」=「匹配這些操作數,操作數類型是:std :: string = {...}」
我找不出這裏的問題。如果我運行程序,它會正確地分配「a」,但不是「b」。
你不能插入兩個字符串到同一個地方。此外,使用現在的索引,它只會填充數組的對角線。 – InternetAussie
你的標題是'<=',但你的文字是'='。 – aschepler
你認爲那條線有什麼作用?左邊的東西只有一個字符串,但右邊的是兩個字符串。你如何設定一個等於另一個? –