// file: lecture_36/example.cc // // include files // #include "HashTable.h" // local constants // #define MAX_LINE_LEN 99 //define the hash table size // // method: main // // read command line arguments and load them into the list // int main(int argc, char** argv) { // create a hash table // HashTable foo; //declare buffer space for a line // char buf[MAX_LINE_LEN]; //open the input file // FILE* fp=fopen(argv[1],"r"); if (fp== (FILE*)NULL) { fprintf(stdout,"<%s>: error opening file (%s)\n", argv[0], argv[1]); } // loop over the file and read lines // while (fgets(buf, MAX_LINE_LEN, fp)!=(char*)NULL) { //remove the linefeed // buf[strlen(buf)-1]=(char)NULL; //add the item to the hash table // foo.insert(atoi(buf)); } //print the hash table // foo.display(); //Access the value 1100 in our example from kahoot // //answer 1 fprintf(stdout,"kahoot value example is %d\n",foo.get_table()[0].get_head()->get_data()); //answer 2 //fprintf(stdout,"kahoot value example is %d\n",foo.get_table()[0].get_head().get_data()); //answer 3 //fprintf(stdout,"kahoot value example is %d\n",foo->get_table()[0]->get_head().get_data()); //answer 4 //fprintf(stdout,"kahoot value example is %d\n",foo.table_d[0].head_d->data_d); //retrieve data: FILL IN RUNNING RETRIEVE MEMBER FUNCTION // // exit gracefully // return(0); }