Hello.
Here is a snippet:
#include "stdafx.h" #include <iostream> #include <string> std::string MainStr = "Word1:Word2:Word3:Word4:Word5"; std::string S = ":"; short X = 0; for (int i = 0; i < MainStr.length(); i++) { if (MainStr[i] == S) { X = X + 1; } } For some reason, he writes a binary '==' : no operator found which takes a left-hand operand of type 'char' (or there is no acceptable conversion) error binary '==' : no operator found which takes a left-hand operand of type 'char' (or there is no acceptable conversion) in the condition string.
What's wrong?
find_first_ofmethod to find the desired character? size_t pos = 0; for (X = 0; (pos = MainStr.find_first_of (':', pos))! = string :: npos; pos ++, X ++); - alexlz