#include "hash.H" void print_menu(); main() { HashTable HT; // default size -- can be changed using // the other constructor. char option; print_menu(); cin >> option; while ((option != 'E') && (option != 'e')) { switch (option) { case 'i': case 'I': { Student_Entry s; cout << "Last name of student: "; cin >> s.last_name; cout << "First name of student: "; cin >> s.first; cout << "Middle initial of student: "; cin >> s.middle; cout << "Student ID:"; cin >> s.ID; cout << "Class: "; cin >> s.student_class; if (HT.insert(s) == success) cout << s.last_name << " Inserted." << endl; else cout << "Student " << s.last_name << " not inserted." << endl; break; } case 'd': case 'D': { string ID; cout << "ID of student: "; cin >> ID; if (HT.remove(ID)== success) cout << ID << " found." << endl; else cout << "Student with ID " << ID<< " not found." << endl; break; } case 'q': case 'Q': { cin >> option; Student_Entry s; if ((option == 'n') || (option == 'N')){ string name; cout << "Last name of student: "; cin >> name; if (HT.retrieve_name(name,s) == entry_found) { cout << "Name: " << s.last_name << ", "<< s.first << " " << s.middle << "." << endl; cout << "ID: " << s.ID << " Class: " << s.student_class << endl; } else cout << "Student " << name << " not found." << endl; } else if ((option == 'I') || (option == 'i')) { string id; cout << "ID of student: "; cin >> id; if (HT.retrieve_ID(id,s) == entry_found) { cout << "Name: " << s.last_name << ", "<< s.first << " " << s.middle << "." << endl; cout << "ID: " << s.ID << " Class: " << s.student_class << endl; } else cout << "Student with ID " << id << " not found." << endl; } else cout << "Illegal option " << endl; break; } default: cout << "Illegal option " << endl; } print_menu(); cin >> option; } } void print_menu() { cout << "Options --" << endl; cout << " I - insert a new student record" << endl; cout << " D - delete a new student record (by last name)" << endl; cout << " QI - query a new student record by ID" << endl; cout << " QN - query a new student record by last name" << endl; cout << " E - exit the system" << endl; cout << "Enter an option: "; }