Try this:
Code:
int main()
{
string a = "abc";
int i;
for(i = 0; i <= (int)a.size()-1; i++)
{
if(a[i] != 'b')
{
cout << "Not b, found " << a[i] << endl;
}
else
cout << "Found b" << endl;
}
return 0;
}
Originally Posted by
hqt
I have some code, that have error that I cannot repair by myself:
Code:
int main(){
string a;
int i;
for(i=0;i<=a.size()-1;i++){
if(a[i]!="b"){
//do something
}
}
at line : if(a[i]!="b" have error: ISOC++ forbids comparison between pointer and integer.
So, who help me on this error, please.
thanks