int main() { vector<int> k; for(int j = 0; j < 10; ++j) { k.push_back(j); } VectorContainer test (k); test.print(); cout << test.at(3) << endl; cout << "should be 3" << endl; test.swap(0,1); test.print(); test.size(); test.insert(15); test.print(); cout << "break" << endl; list <int> l; for(int j = 0; j < 10; ++j) { l.push_back(j); } ListContainer testlst (l); testlst.print(); cout << testlst.at(3) << endl; cout << "should be 3" << endl; testlst.swap(0,1); testlst.print(); testlst.size(); testlst.insert(15); testlst.print(); return 0; }
int main() { // srand(time(NULL)); //vector bubble sort cout << "vector bubble sort" << endl; VectorContainer vc; SortAlgorithm* bs = new BubbleSort(); cout << "BEFORE: "; vc.print(); vc.set_sort(bs); vc.sort(); vc.print(); cout << endl; //vector selection sort cout << "vector seleciton sort" << endl; VectorContainer vc1; SortAlgorithm* ss = new SelectionSort(); cout << "BEFORE: "; vc1.print(); vc1.set_sort(ss); vc1.sort(); vc1.print(); //vector merge sort cout << "vector merge sort" << endl; VectorContainer vc2; SortAlgorithm* ms = new MergeSort(); cout << "BEFORE: "; vc2.print(); vc2.set_sort(ms); vc2.sort(); vc2.print(); cout << endl; //filled vector bubble sort cout << "filled vector bubble sort" << endl; VectorContainer vc3; SortAlgorithm* bs1 = new BubbleSort(); cout << "BEFORE: "; vc3.randHun(20); vc3.print(); vc3.set_sort(bs1); vc3.sort(); vc3.print(); cout << endl; //filled vector selection sort cout << "filled vector selection sort" << endl; VectorContainer vc4; SortAlgorithm* ss1 = new SelectionSort(); cout << "BEFORE: "; vc4.randHun(20); vc4.print(); vc4.set_sort(ss1); vc4.sort(); vc4.print(); cout << endl; //filled vector merge sort cout << "filled vector merge sort" << endl; VectorContainer vc5; SortAlgorithm* ms1 = new MergeSort(); cout << "BEFORE: "; vc5.randHun(20); vc5.print(); vc5.set_sort(ms1); vc5.print(); cout << endl; //list bubble sort cout << "list bubble sort" << endl; ListContainer lc; SortAlgorithm* bs2 = new BubbleSort(); cout << "BEFORE: "; lc.print(); lc.set_sort(bs2); lc.sort(); lc.print(); cout << endl; //list selection sort cout << "list seleciton sort" << endl; ListContainer lc1; SortAlgorithm* ss2 = new SelectionSort(); cout << "BEFORE: "; lc1.print(); lc1.set_sort(ss2); lc1.sort(); lc1.print(); cout << endl; //list merge sort cout << "list merge sort" << endl; VectorContainer lc2; SortAlgorithm* ms2 = new MergeSort(); cout << "BEFORE: "; lc2.print(); lc2.set_sort(ms); lc2.sort(); lc2.print(); cout << endl; //filled list buble sort cout << "list bubble sort" << endl; ListContainer lc3; SortAlgorithm* bs3 = new BubbleSort(); cout << "BEFORE: "; lc3.randHun(20); lc3.print(); lc3.set_sort(bs3); // lc3.sort(); lc3.print(); cout << endl; //filled list selection sort cout << "list selection sort" << endl; ListContainer lc4; SortAlgorithm* ss3 = new SelectionSort(); cout << "BEFORE: "; lc4.randHun(20); lc4.print(); lc4.set_sort(ss3); lc4.sort(); lc4.print(); cout << endl; //filled list merge sort cout << "list merge sort" << endl; ListContainer lc5; SortAlgorithm* ms3 = new MergeSort(); cout << "BEFORE: "; lc5.randHun(20); lc5.print(); lc5.set_sort(ms3); lc5.sort(); lc5.print(); cout << endl; delete bs; delete ms; delete ss; delete bs1; // delete ms1; // delete ss1; return 0; }