Here is the world famous how many characters in this C++ string job interview question?
Also, here is a way to find the number of words in a string (same as count number of specific characters) This always reports 1 more than so maybe display count – 1?
#include
#include
using namespace std;
int main()
{
int i, numspaces;
char nextChar;
string msg;
numspaces=1;
cout << "Type in a string\n";
getline(cin, msg);
// checks each character in the string
for (i=0; i