Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- #include "Criminal.h"
- #include "BinaryTree.h"
- using namespace std;
- int main()
- {
- char firstName[30];
- char lastName[30];
- char fullName[60];
- char Crime[30];
- int Months;
- int counter = 0;
- Criminal* crimPtr;
- BinaryTree binarytree;
- DataType datatype;
- ifstream ifs;
- ifs.open("crims.txt"); // name of file is hardcoded so no error checking needed
- ifs >> firstName;
- while(!ifs.eof())
- {
- ifs >> lastName;
- ifs >> Crime;
- ifs >> Months;
- strcat(lastName, ", ");
- strcat(lastName, firstName);
- strcpy(fullName, lastName);
- crimPtr = new(nothrow) Criminal(fullName, Crime, Months);
- binarytree.Insert(crimPtr);
- ifs >> firstName;
- }
- return 0;
- }
- int TreeDataCmp(const DataType& crim1, const DataType& crim2)
- {
- return (crim1->compareName(*crim2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement