There are probably hundreds of ways to input strings. My favorites are listed below. For more information I'd suggest looking in the book's Appendix pages A32-A35, referencing the newsgroups, looking through the MSDN library (I'm sure you like hearing that by now), or emailing me.

A few string functions:

getline(target, maxsize)
getline takes as its arguments a target which is a C-string, a maximum size, and optionally a dilimiter character. An example call might be:

cin.getline(aSentence, MAX_SIZE);
This will bring in keyboard input up to and not including the first carriage return and store it in the aSentence variable.

get(target, maxsize)
get is almost exactly like getline except that it leaves the carriage return for the next read operation to deal with (there is probably no reason for you to leave that carriage return hanging around in HW1)...

cin.get(aSentence, MAX_SIZE);

gets(target)
This function is almost exactly like getline only it is doesn't require a MAX_SIZE, which may be the best way to approach this program:

char sentence[MAX_SENTENCE_SIZE];
get(sentence);

Introductory Programming II for the Department of Computer Science and Engineering at the University of Washington
Maintained by jeffwest@cs.washington.edu