Posted By

DrPepper on 11/11/11


Tagged


Versions (?)

[CISP 430] Chaining Hash Table (drive.cpp)


 / Published in: C++
 

  1. #include <iostream>
  2. #include "table2.h"
  3. #include "link2.h"
  4. using namespace std;
  5.  
  6. //TEST FILE HAS TO INCLUDE FOLLOWING EXAMPLES
  7. // 1.Instantiate two Table objects and each with 10 fields.
  8. // 2.Display the two Table objects’ information.
  9. // 3.Use random number generator to generate 70 numbers each in between 0~200 for the Table objects.
  10. // 4.Display the two Table objects’ information.
  11. // 5.Removes all the data in first object.
  12. // 6.Display the two Table objects’ information.
  13. // 7.Using = to assign 2nd object to the first one.
  14. // 8.Display the two Table objects’ information.
  15. int main ()
  16. {
  17. cout << "******** CHAINING HASH TABLE PROGRAMMING ********"<<endl;
  18. cout << "1.Instantiate two Table objects and each with 10 fields."<< endl;
  19. typedef int RecordType;
  20. Table<RecordType> test1;
  21. Table<RecordType> test2;
  22. Table<RecordType> empty;
  23. int i=0;
  24. // INSERT 10 NULLS
  25. while(i<10)
  26. { test1.insert('NULL'); }
  27. i=0;
  28. while(i<10)
  29. { test2.insert('NULL'); }
  30. i=0;
  31. // PRINT THEM
  32. while(i<10)
  33. { test1.print(i); cout << endl; }
  34. i=0;
  35. while(i<10)
  36. { test2.print(i); cout << endl; }
  37. i=0;
  38. test1 = empty;
  39. test2 = empty;
  40.  
  41. cout << "1.Instantiate two Table objects and each with 10 fields."<< endl;
  42. return 0;
  43. }

Report this snippet  

You need to login to post a comment.