// Based on Astrachan, p 247 //----------------------------- #include #include using namespace std; #include "prompt.h" #include "worditer.h" int main() { string word; int numWords = 0; // initially, no words WordStreamIterator iter; iter.Open(PromptString("enter name of file: ")); for (iter.Init(); iter.HasMore(); iter.Next()) { numWords++; } cout << "number of words read = " << numWords << endl; return 0; } /* Sample Output arapaho dr> wordstit enter name of file: wordstit.cpp number of words read = 78 */