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;
}

Recommended Answers

All 3 Replies

What's a problem?..Detail please..

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()

In other words you want to cheat your teacher (and yourself)...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.