Original Post
sorry ive posted like 3 topics already :[
ok im using std strings, now im trying to run through the string and count every time a space appears in the string..
ive tried this..
however i get the errors:
C:\Microsoft Visual Studio\MyProjects\strs\main.cpp(20) : error C2446: ''=='' : no conversion from ''char *'' to ''int''
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\Microsoft Visual Studio\MyProjects\strs\main.cpp(20) : error C2040: ''=='' : ''int'' differs in levels of indirection from ''char [2]''
Error executing cl.exe.
i tried placing the space in single quotes but that generates more errors.
how can i go about comparing individual elements of the string array?
for (int x=0; x<strInput.length(); x++) {
if (strInput[x] == " ")
{
spaceCount++;
}
}
|