In my book I am given this exercise to do at the end of Chapter 5.
Now I have a good idea of what to do - IE: using funtions in the cctype header. What erks me though, is the part about the characters 'entered on a line' What does that mean? Do I ask the user to enter a sentance with a # at the end? I am confused by this because the only variable that I have learned about so far that stores a character are variable of type char... and if I am not mistaken a variable of type char is only able to hold one character, right? I have not learned about strings yet, that's the next chapter.Code:Exercise 5-3 Create a program that uses a do while loop to count the numbers of non-whitespace characters entered on a line. The count will end when it first encounters the character '#'.
So, how am I supposed to do this? The book is Ivor Horton's Beginning ANSI C++: The complete language. So if you are familiar with the book -- please help me out here! Also, the source code for the exercises is available from the books website to view... IE: If you are stuck or if you want to see if it's done right. I don't want to look at the code -- but I am completely stumped on how to take the input from the user - or if it's even supposed to be input from the user! AHHHH!