void catchlabel()
{
if(vecs.empty())
return;
else
{
cout << "The Sizeof the Vector is: " << vecs.size() << endl;
cout << "Currently Stored Labels: " << endl;
/* Error 1 */
for (int i = 1, vector<string>::iterator it = vecs.begin(); it != vecs.end(); ++it , i++)
cout << i << ". "<< *it << endl;
cout << endl;
}
}
我收到以下错误:错误迭代器的声明在for循环中
1>错误C2146:语法错误:标识符‘它’
如何解决这个问题之前缺少“” ?
@Downvoter:为什么的答案都-1'd?他们都是正确的。 – GManNickG 2011-03-23 15:37:35
Duplicate-sh:http://stackoverflow.com/questions/3440066/why-is-it-so-hard-to-write-a-for-loop-in-c-with-2-loop-variables – GManNickG 2011-03-23 15:39:34
possible [我可以在for循环的初始化中声明不同类型的变量吗?](http://stackoverflow.com/questions/8644707/can-i-declare-variables-of-different-types-in-the-初始化一个for循环) – 2012-08-17 05:43:40