Please send questions to
st10@humboldt.edu .
//---------------------------------------------------------------
// File: trySet.cpp
// Name: Sharon M. Tuttle
// last modified: 3-10-04
//
// Purpose: try the set class out a little
//
//--------------------------------------------------------------
#include <iostream>
#include "set.h"
using namespace std;
int main()
{
// try out both constructors
set mySet1;
set mySet2(50);
// put some items in mySet1
mySet1.insert(13);
mySet1.insert(5);
mySet1.insert(13);
mySet1.insert(5);
mySet1.insert(26);
cout << endl;
cout << "Trying class set..." << endl;
cout << endl;
cout << "mySet1's size should be 3; it is: " << mySet1.size() << endl;
cout << "mySet2's size should be 0; it is: " << mySet2.size() << endl;
cout << endl;
cout << "mySet1's capacity should be 30; it is: "
<< mySet1.curr_capacity() << endl;
cout << "mySet2's capacity should be 50; it is: "
<< mySet2.curr_capacity() << endl;
// remove 13 and 5 from mySet1
mySet1.remove(13);
mySet1.remove(5);
cout << endl;
cout << "13 should not be in mySet1; print 1 if isn't, 0 if is: "
<< (mySet1.contains(13) == false) << endl;
cout << "5 should not be in mySet1; print 1 if isn't, 0 if is: "
<< (mySet1.contains(5) == false) << endl;
cout << "26 should be in mySet1; print 1 if is, 0 if isn't: "
<< (mySet1.contains(26) == true) << endl;
// change the capacity of mySet1
mySet1.reserve(500);
cout << endl;
cout << "mySet1's capacity should now be 500; it is: "
<< mySet1.curr_capacity() << endl;
return EXIT_SUCCESS;
}