linked list pls pls help me

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2008
Posts: 3
Reputation: solimanmuttawa is an unknown quantity at this point 
Solved Threads: 0
solimanmuttawa solimanmuttawa is offline Offline
Newbie Poster

linked list pls pls help me

 
0
  #1
Nov 23rd, 2008
i am done with the main of the program but i have difficulty with several functions that need help if u please help me thank u very much

#include <iostream>
#include <string>
using namespace std;

void Output(struct Employee *data_ptr);
void Input(struct Employee *data_ptr);
void AddElement_Front(struct Employee E);
void AddElement_End(struct Employee E);
void AddElement_Sorted(struct Employee E);
void DeleteFirst();
void DeleteLast();
void DeleteElement(int ID);

int ListCount();
int ListSize();
void PrintList();
void SortList();
struct Employee MinElement();
struct Employee MaxElement();


struct Employee
{
int id_number;
int age;
float salary;
string name;
struct Employee* next;
};


struct Employee *head = NULL;

void main()
{
int Operation = 1;

cout<<"Press 1 to add element to the front of the list"<<endl;
cout<<"Press 2 to add element to the end of the list"<<endl;
cout<<"Press 3 to add element in sorting order of the list"<<endl;
cout<<"Press 4 to delete the first element from the list"<<endl;
cout<<"Press 5 to delete the last element from the list"<<endl;
cout<<"Press 6 to delete a given element from the list"<<endl;
cout<<"Press 7 to print the list"<<endl;
cout<<"Press 8 to count the number of elements in the list"<<endl;
cout<<"Press 9 to calculate the size of the list"<<endl;
cout<<"Press 10 to sort the list"<<endl;
cout<<"Press 11 to find the minimum element in the list"<<endl;
cout<<"Press 12 to find the maximum element in the list"<<endl;
cout<<"Press -1 to exit"<<endl;

while(Operation != -1)
{

cout<<"\nChoose Operation : ";
cin>>Operation;

struct Employee Element;
switch(Operation)
{
case 1 :
Input(&Element);
AddElement_Front(Element);
break;
case 2 :
Input(&Element);
AddElement_End(Element);
break;
case 3 :
Input(&Element);
AddElement_Sorted(Element);
break;
case 4:
DeleteFirst();
break;
case 5:
DeleteLast();
break;
case 6:
int ID;
cout<<"Enter the ID of the employee you want to delete : ";
cin>>ID;
DeleteElement(iD);
break;
case 7:
PrintList();
break;
case 8:
int N;
N=ListCount();
cout<<"The number of elements in the list is : "<<N<<endl;
break;
case 9:
int S;
S=ListSize();
cout<<"The size of the list is : "<<S<<" bytes"<<endl;
break;
case 10:
SortList();
PrintList();
break;
case 11:
Element = MinElement();
cout<<"The Employee with minimum ID : "<<endl;
Output(&Element);
break;
case 12:
Element = MaxElement();
cout<<"The Employee with maximum ID : "<<endl;
Output(&Element);
break;
}
}
}

void Output(struct Employee *data_ptr)
{
cout<<"******************************\n";
cout<<"ID = "<<data_ptr->id_number<<endl;
cout<<"Name = "<<data_ptr->name<<endl;
cout<<"Age = "<<data_ptr->age<<endl;
cout<<"Salary = "<<data_ptr->salary<<endl;
cout<<"******************************\n";
}
void Input(struct Employee *data_ptr)
{
cout<<"******************************\n";
cout<<"Enter ID : ";
cin>>data_ptr->id_number;
cout<<"Enter Name : ";
cin>>data_ptr->name;
cout<<"Enter Age : ";
cin>>data_ptr->age;
cout<<"Enter Salary : ";
cin>>data_ptr->salary;
cout<<"******************************\n";
}
void AddElement_Front(struct Employee E)
{
//Fill in the code
}
void AddElement_End(struct Employee E)
{
//Fill in the code
}
void AddElement_Sorted(struct Employee E)
{
//Fill in the code
}
void DeleteFirst()
{
//Fill in the code
}
void DeleteLast()
{
//Fill in the code
}
void DeleteElement(int ID)
{
//Fill in the code
}
void PrintList()
{
//Fill in the code
}
int ListCount()
{
int N;
//Fill in the code
return N;
}
int ListSize()
{
int S;
int Count = ListCount();
S=Count * sizeof(struct Employee);
return S;
}
void SortList()
{
//Fill in the code
}
struct Employee MinElement()
{
struct Employee min;
//Fill in the code
return min;
}
struct Employee MaxElement()
{
struct Employee max;
//Fill in the code
return max;
}
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 320
Reputation: cikara21 is an unknown quantity at this point 
Solved Threads: 63
cikara21's Avatar
cikara21 cikara21 is offline Offline
Posting Whiz

Re: linked list pls pls help me

 
0
  #2
Nov 23rd, 2008
What's a problem?..Detail please..
.:-cikara21-:.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 3
Reputation: solimanmuttawa is an unknown quantity at this point 
Solved Threads: 0
solimanmuttawa solimanmuttawa is offline Offline
Newbie Poster

Re: linked list pls pls help me

 
0
  #3
Nov 23rd, 2008
i cant write the following fuctions:
1)void AddElement_Front(struct Employee E)
2)void AddElement_End(struct Employee E)
3)void AddElement_Sorted(struct Employee E)
4)void DeleteFirst()
5)void DeleteLast()
6)struct Employee MinElement()
7)struct Employee MaxElement()
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: linked list pls pls help me

 
0
  #4
Nov 23rd, 2008
In other words you want to cheat your teacher (and yourself)...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC