Im seriously not even sure what this proj is suppposed to do, but we're supposed to create an ordered double linked list data structure. Its gonna have insert, traverse, search and delete. The program is gonna use static file names. I have code for a single linked list, but I dont know how to do double.

Heres most of the code so far I believe, but I have to do it with files in the insert function

PHP Code:
#include "stdafx.h"
#include <fstream>
#include <iostream>

using namespace std;

struct record
{
    
record *next
    record 
*prev;
};


int delete_item(record *headint);
void traverse(record *head);
record *search(record *headint);

int main(int argccharargv[])
{

    
record *head;
    
record *tail;
    
head NULL;
    
tail NULL;
    

    return 
0;
}


int insert(record *headrecord *item)
{
    if(
item==NULL)
        return -
1;
    if(
head==NULL)
    {
        
item->next NULL;
        
head item;
        return 
0;
    }
    if(
item->key head->key)
    {
        
item->next head;
        
head item;
        return 
0;
    
        
record *temp head;
        while((
temp->next !=NULL) &&
             (
temp->next->key <= item->key))
             
temp temp->next;
        
item->next temp->next;
        
temp->next item;


void traverse(record *head)
{
    
record *temp head;
    while(
temp !=NULL)
    {
        
cout << temp->key << endl;
        
temp temp->next;
    }
    return;
}


record *search(record *headint key)
{
    
record *temp head;
    while(
temp !=NULL)
    {
        if(
temp->key == key)
            return 
temp;
        
temp temp->next;
    }
    return 
NULL;
}
    

int delete_item(record *headint key)
{
    if(
head == NULL)
        return -
1;
    if(
head->key == key)
    {
        
record *temp2 head;
        
head head->next;
        
delete temp2;
        return 
0;
    }

        
record *temp head;
        while((
temp->next !=NULL) &&
            (
temp->next->key !=key))
            
temp temp->next;
        if(
temp->next == NULL)
            return -
1;
        
record *temp2 temp->next;
        
temp->next temp2->next;
        
delete temp2;
        return 
0;

I beelive that somwhere in the insert fuction I need to add this

PHP Code:
while (!infile.eof)
{
item = new record;
infile.getline(item->name)
infile.getline(item->ssn.item)
insert(head,tail,item