Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ============================================================================
- Name : Homework3.c
- Author :
- Version :
- Copyright : Your copyright notice
- Description : Hello World in C, Ansi-style
- ============================================================================
- */
- #include <stdio.h>
- #include <stdlib.h>
- #inclue <string.h>
- #include "Table.h"
- int main(int argc, const char * argv[])
- {
- char* banana = "banana";
- char* monkey = "monkey";
- char* juice = "juice";
- char* store = "store";
- char * orange = "orange";
- char* apple = "apple";
- char* cheese = "cheese";
- char* array[7] = {banana, monkey, juice, store, orange, apple, cheese};
- int arraySize = 7;
- Table* table1 = createTable();
- Table* table2 = createTable();
- Table* emptyTable = createTable();
- if(table1 && table2 && emptyTable)
- printf("\nTables successfully created!\n");
- //-------------------------------------------------
- // TESTING INSERT
- //-------------------------------------------------
- printf("\n\nInserting items:\n");
- printf("\nInserting into Table1:\n");
- for(int x = 0; x < arraySize; x++)
- {
- if(insert(array[x], table1))
- {
- printf("Successfully inserted %s into table1\n",array[x]);
- }
- }
- printf("\nInserting into Table2:\n");
- for(int x = 0; x < arraySize; x++)
- {
- if(insert(array[x], table2))
- {
- printf("Successfully inserted %s into table2\n",array[x]);
- }
- }
- //-------------------------------------------------
- // TESTING DELETE
- //-------------------------------------------------
- printf("\n\nDeleting items:\n");
- printf("\nDeleting items in Table1:\n");
- for(int x = 0; x < (int)(arraySize/2); x++)
- {
- if(delete(table1))
- {
- printf("Successfully deleted\n");
- }
- }
- //-------------------------------------------------
- // TESTING SEARCH
- //-------------------------------------------------
- printf("\n\nSearching for items:\n");
- //-------------------------------------------------
- // TESTING CLEAR AND DESTROY
- //-------------------------------------------------
- printf("\n\nDeleting tables:\n");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement