I am trying to to get this program to find and count the spaces in a string of characters and display the count.
I am not sure of my codes and the error message that I got seems a little bit strange. Can anyone look at my codes and give me some pointers.
My os is VC++ ver. 6.0, I have a desktop using win 2k.
My codes and the returned errors.
using namespace std;
// not used --->char locate_blank(char *);
char line = "This is a string test. It contains two sentence.";
cout << "The original sentence is : " << line;
for (count = 0; line[count]= ''; count++)
if (line[count] == ' ')
line[count+1] = ' ';
cout << "This sentence contains" << count(line) << "blanks";
/* Error list
------Configuration: findBlanks#2 - Win32 Debug-------
C:DocumentsDesktopfindBlanks#2.cpp(23) : error C2064: term does not evaluate to a function
Error executing cl.exe.
findBlanks#2.obj - 1 error(s), 0 warning(s)