Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. /*
  2. ============================================================================
  3. Name : Homework3.c
  4. Author :
  5. Version :
  6. Copyright : Your copyright notice
  7. Description : Hello World in C, Ansi-style
  8. ============================================================================
  9. */
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #inclue <string.h>
  14. #include "Table.h"
  15.  
  16. int main(int argc, const char * argv[])
  17. {
  18. char* banana = "banana";
  19. char* monkey = "monkey";
  20. char* juice = "juice";
  21. char* store = "store";
  22. char * orange = "orange";
  23. char* apple = "apple";
  24. char* cheese = "cheese";
  25.  
  26. char* array[7] = {banana, monkey, juice, store, orange, apple, cheese};
  27. int arraySize = 7;
  28.  
  29. Table* table1 = createTable();
  30. Table* table2 = createTable();
  31. Table* emptyTable = createTable();
  32. if(table1 && table2 && emptyTable)
  33. printf("\nTables successfully created!\n");
  34.  
  35. //-------------------------------------------------
  36. // TESTING INSERT
  37. //-------------------------------------------------
  38. printf("\n\nInserting items:\n");
  39. printf("\nInserting into Table1:\n");
  40. for(int x = 0; x < arraySize; x++)
  41. {
  42. if(insert(array[x], table1))
  43. {
  44. printf("Successfully inserted %s into table1\n",array[x]);
  45. }
  46. }
  47.  
  48. printf("\nInserting into Table2:\n");
  49.  
  50. for(int x = 0; x < arraySize; x++)
  51. {
  52. if(insert(array[x], table2))
  53. {
  54. printf("Successfully inserted %s into table2\n",array[x]);
  55. }
  56. }
  57.  
  58. //-------------------------------------------------
  59. // TESTING DELETE
  60. //-------------------------------------------------
  61. printf("\n\nDeleting items:\n");
  62. printf("\nDeleting items in Table1:\n");
  63. for(int x = 0; x < (int)(arraySize/2); x++)
  64. {
  65. if(delete(table1))
  66. {
  67. printf("Successfully deleted\n");
  68. }
  69. }
  70.  
  71. //-------------------------------------------------
  72. // TESTING SEARCH
  73. //-------------------------------------------------
  74.  
  75. printf("\n\nSearching for items:\n");
  76.  
  77.  
  78. //-------------------------------------------------
  79. // TESTING CLEAR AND DESTROY
  80. //-------------------------------------------------
  81.  
  82. printf("\n\nDeleting tables:\n");
  83. return EXIT_SUCCESS;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement