/**************************************************** This is the final version of the test program for Assignment 4, CS 146. I may be testing your program with other B-tree orders, invocations of "draw", etc. so you might as well. But these are all the tests you need to hand in. ****************************************************/ #pragma warning(disable : 4786) #include "btree.h" #include "copop.h" #include #include int main() { BTreeb1=BTree(5); BTreeb2=BTree(5); ifstream ifs("conum.txt"); if (!ifs) { cerr << "file not found" << endl; exit(1); } string k1,k2; while (!ifs.eof()) { CountyPop c(ifs); k1=c.getKey1(); k2=c.getKey2(); b1.insert(k1,c); b2.insert(k2,c); } ifs.close(); b1.traverse(ofstream("copop1.txt")); b2.traverse(ofstream("copop2.txt")); b1.report(cout); b2.report(cout); cout << b1.search("Los Angeles County CA") << endl; cout << b1.search("Loving County TX") << endl; cout << b1.search("Santa Clara County CA") << endl; cout << b1.search("Santa Claus County CA") << endl; cout << b2.search("CA Los Angeles County") << endl; cout << b2.search("TX Loving County") << endl; cout << b2.search("CA Santa Clara County") << endl; cout << b2.search("CA Santa Claus County") << endl; BTree b(3); b.insert(8,88); b.insert(5,55); b.insert(4,44); b.insert(9,99); b.insert(1,11); b.insert(7,77); b.insert(6,66); b.insert(3,33); b.draw(cout); cout << b.search(6) << endl; cout << endl; int i; BTree c(3); for (i=1; i<=100; i++) c.insert(i,i*i); c.draw(cout); for (i=1; i<=101; i+=5) cout << i << ":" << c.search(i) << endl; return 0; }