Académique Documents
Professionnel Documents
Culture Documents
submitted to:-
ma'am rida hijab
submitted by:-
Sadaf Ashfaq
Sherbano
code
#include<iostream>
#include<string>
struct employee
int E_ID;
string name;
int age;
char gender;
string address;
string pnumb;
string department;
string dop;
string designation;
double salary;
employee *next;
};
struct hashnode
employee *E[10];
int key;
public:
hashnode()
E[i] = NULL;
value->next = NULL;
key = hashfun(value->E_ID);
if (E[key] == NULL)
E[key] = value;
else
Insert(value);
prev = entry;
entry = entry->next;
prev->next = value;
value->next = NULL;
int i = hashfun(id);
if (temp != NULL)
temp = temp->next;
return true;
else
return false;
else
return false;
int i = hashfun(id);
employee * T = E[i];
employee* Prev = nullptr;
if (E[i] != nullptr)
E[i] = nullptr;
else
while (T != nullptr)
if (T->E_ID == id)
if (Prev == nullptr)
E[i] = E[i]->next;
delete T;
return;
delete T;
Prev->next = nullptr;
return;
}
else
Prev->next = T->next;
T = nullptr;
return;
Prev = T;
T = T->next;
void display()
if (E[i] != NULL)
cout << "ID: " << temp->E_ID << "\nName: " <<
temp->name << "\nAge: " << temp->age << "\nGender: " << temp->gender <<
"\nAddress: " << temp->address << "\nPhone Number: " << temp->pnumb <<
"\nDepartment> " << temp->department << "\nDate of appointment> " << temp->dop <<
"\nDesignation> " << temp->designation << "\nSalary> " << temp->salary;
temp = temp->next;
int hashfun(int V)
return V % tables;
};
int main()
hashnode H;
employee e;
char y;
int choice = 0;
cout << "enter 1 for insertion, 2 for search index, 3 for deletion";
while(choice != -1)
if(choice == 1)
//getline(cin, e->name);
//getline(cin, e->address);
//getline(cin, e->designation);
H.inserthash(e);
H.display();
if(choice == 2)
if (H.search(e.E_ID))
else
if (choice == 3)
H.Del(e.E_ID);
H.display();
}
}
system("pause");
return 0;
output