I think what we have here is a failure to comunicate. I caved - I looked at the source code and I have to say, I'm suprised at the solution.... Here it is:
Code:
// Exercise 5.3 Using a do-while loop to count characters
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main() {
long count= 0L;
char ch;
cout << "Please enter a sequence of characters terminated by '#':" << endl;
// We have to read at least one character - even if it's '#' - so do-while is best
do {
cin >> ch;
++count;
} while (ch != '#');
// We do not count '#' as a character, so count must be adjusted
--count;
cout << "You entered " << count
<< " characters (not counting spaces and the terminal #)." << endl;
return 0;
}
Very... simple. (now this is the part where I feel like a moron... not due to me not being able to solve it - but not understanding really how to solve it... the exercises really are not very specific as you can probably tell.)
EDIT: and I was under the impression that char could only hold one variable. IE: one letter. I was very wrong... and I guess that's what confused me the most.