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