// Tree with string objects // Author: Sven Eisenhauer // Date: 05.06.05 #include using std::cout; using std::cerr; using std::cin; using std::endl; #include using std::ofstream; using std::ifstream; using std::ios; #include using std::string; #include #include #include "Tree.h" int main() { int wordsInFile=0; Tree< string > wordTree; string word; ifstream inFile( "max.txt", ios::in ); if( !inFile ) { cerr << "Input-Datei konnte nicht geoeffnet werden." << endl; exit( 1 ); } while( inFile >> word) { wordTree.insertNode( *( new string( word ) ) ); wordsInFile++; } wordTree.inOrderTraversal(); cout << "Words in input file: "<< wordsInFile << endl; cout << "Different words: " << wordTree.gettreeElementCount() << endl; return 0; }