F50 0 Newbie Poster

hi there,

I have a linked of structures that I created, but i wanted to implement it using classes. here is a sample of my code that works perfect. The struct, and a function to insert items into the linked list. thanks in advance.

struct NodeQ
{
	NodeQ *next;
	int process_id;
	double burst_time;
	int priority;
	
};



//insert Event From the back of the List
void insertLast(NodeQ *&temp, int process, double time, int priority)
{
	NodeQ *newNode;
	newNode=new NodeQ;
	if (temp==NULL)
	{
		//enter data
		newNode->process_id = process;
		newNode->burst_time = time;
		newNode->priority = priority;
		
		newNode->next=temp;
		temp=newNode;		
	}
	else
	{
		NodeQ *curr;
		curr=temp;
		while(curr->next!=NULL)
		{
			curr=curr->next;
		}
		
		newNode->process_id = process;
		newNode->burst_time = time;
		newNode->priority = priority;
		
		newNode->next=NULL;
		curr->next=newNode;		
	}
} //end insertLast()