-6

以下代码块对我不起作用。编译器说 for 需要一个参数。

确切的错误消息是预期的表达式

alfa_it = alfa_list.begin();
cout << "the parties that are flying on Alfa are";
cout << for (alfa_it = alfa_list.begin(); alfa_it != alfa_list.end(); alfa_it++)
cout << " " << *alfa_it;
cout << endl;

ps alfa 是故意拼错的。

4

1 回答 1

4

你不能forcout::operator<<. 您可能正在寻找:

cout << "the parties that are flying on Alfa are";
for (alfa_it = alfa_list.begin(); alfa_it != alfa_list.end(); alfa_it++)
    cout << " " << *alfa_it;
cout << endl;
于 2012-12-07T01:26:54.453 回答