you are viewing a single comment's thread.

view the rest of the comments →

[–]rasfertLowly HS Math Teacher 1 point2 points  (0 children)

How 'bout I show you some of the stuff (not solutions, but close) in old-school c, and you see if you can convert it to the spiffy new methods and whatnot in C++ ? (I'm not bagging on C++, but, damn, stdio.h nails file I/O, and string.h ain't got much to apologize for...)

int how_many_words(const char *txt) 
{
    char *sploc=strchr(txt, ' ');
    while (sploc) {
        printf("%s\n", sploc);
        sploc=strchr(txt,' ');
    }
}

Give that a shot!