我正在尝试运行以下代码:-
#include <iostream>
using namespace std;
int main()
{
string animals[2][3] =
{
{"Fox", "Hyena", "Lion"},
{"Goat", "Rooster", "Buffalo"}
};
for(int i = 0; i < 2; i++)
{
for(int j = 0; j < 3; j++)
{
cout << animals[i][j]; " ";
<< flush;
}
cout << endl;
}
return 0;
}
但是我收到一个错误:
Error: expected primary-expression before '<<' token)
答案 0 :(得分:1)
您这里还有;
,
cout << animals[i][j]; " ";
<< flush;
相反,它必须是:
cout << animals[i][j] << " " << flush;