summaryrefslogtreecommitdiffstats
path: root/Bachelor/Prog2/person-tree/main.cpp
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Bachelor/Prog2/person-tree/main.cpp
downloadStudium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.gz
Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Bachelor/Prog2/person-tree/main.cpp')
-rw-r--r--Bachelor/Prog2/person-tree/main.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/Bachelor/Prog2/person-tree/main.cpp b/Bachelor/Prog2/person-tree/main.cpp
new file mode 100644
index 0000000..c44a7ba
--- /dev/null
+++ b/Bachelor/Prog2/person-tree/main.cpp
@@ -0,0 +1,47 @@
+// Tree with string objects
+// Author: Sven Eisenhauer
+// Date: 05.06.05
+
+#include <iostream>
+using std::cout;
+using std::cerr;
+using std::cin;
+using std::endl;
+
+#include <fstream>
+using std::ofstream;
+using std::ifstream;
+using std::ios;
+
+#include <string>
+using std::string;
+
+#include <cstdlib>
+#include <new>
+
+#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;
+}