error main.cpp: 14: 27: error: ISO C++ forbids comparison between
pointer and integer [-fpermissive]
Answer 1, authority 100%
This will be correct:
# include & lt; iostream & gt;
#include & lt; cstring & gt;
using namespace std;
void searchCenzur ()
{
char str [80] = "lsasacsalolcassalolasclolcascaslol";
int j = 0;
for (int i = 0; i & lt; 80; i ++)
{
if (str [i] == 'l')
{
if (str [i + 1] == 'o')
{
if (str [i + 2] == 'l')
{
j ++;
}
}
}
}
cout & lt; & lt; "number of matches:" & lt; & lt; j & lt; & lt; endl;
}
int main ()
{
searchCenzur ();
return 0;
}
if (str [i] == "l")
You are comparing one character with a string (character set), in C++ this is not possible, only a character with a character and in the same encoding.
UPD:
Judging by the code, you need to find the number of substring matches in the string – if you wanted to solve this particular problem, then out-of-the-box solution in a neighboring topic .