when compile, compiler says that find is an undeclared identifier.Code:#include <iostream> #include <string> #include <functional> using namespace std; int count(const string& s, char c) { string::iterator i=find(s.begin(),s.end(),c); int n=0; while(i!=s.end()) { ++n; i=find(i+1,s.end(),c); } return n; } void main() { cout<<cout("Abcdiadcsa",'a')<<endl; }
find is a standard algorithm, should i include any other head file?




Reply With Quote