我有下面的代碼問題迭代器
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string d="georgia is nice country":
string::iterator my;
for (my=d.begin();my!=d.end();my++) {
cout<<*my<<endl;
}
return 0;
}
但它會導致編譯器錯誤說:「我不確定」。哪裏不對?
抱歉,我已經看到了我的錯誤 – 2010-07-10 07:36:17
如果有人想要的答案後,我會接受它 – 2010-07-10 07:36:54
'使用命名空間std;'這是節省您鍵入每次五個字符從標準庫輸入一個標識符。看到[這個答案](http://stackoverflow.com/questions/2879555/c-stl-how-to-write-wrappers-for-cout-cerr-cin-and-endl/2880136#2880136)爲什麼這是_不是一個好主意。 – sbi 2010-07-10 10:09:05