Below is my Homemade Linked List.
I need to implement a method in the class that will return an
applicant with the smallest number in their date attrib.
Applicants with a date of zero don't count and once an applicant is returned it's date should be set to zero indicating that i've hired them ( hopefully as a programmer )
The Method (doesn't work):
Code:
applicant hire(void){
applicant tmp;
cur=head;
do{
tmp=cur->data;
if(cur->data.date)
cur->data.date=0;
goNext();
}while(!cur->data.date);
return tmp;
}
The Structure:
Code:
struct applicant {
char name[61]; // applicant's name
char phone[21]; // phone number
long date; // date of application in yyyymmdd
operator=(const applicant rhs){
strcpy(name, rhs.name);
strcpy(phone, rhs.phone);
date = rhs.date;
}
};
struct Node{
applicant data;
Node *next, *prev;
Node(){next=prev=NULL;};
Node(applicant data){
this->data = data;
next = prev = NULL;
}
};
class jobfile:public fstream{
protected:
int success, records;
char FileName[30];
Node *cur, *tail, *head;
public:
//Misc. Methods