-
April 1st, 2011, 12:28 PM
#1
Help writing Functions
can someone please help me write these functions, i have looked online and i am having trouble finding how to write them. Thanks
class List
{
private:
int *a;
int count;
int capacity;
public:
List(); // create an empty list with capacity 0
List(int n); // create a list with capacity n
List(List l); // create a list similar to passed object l
~List(); // de-allocates memory from the list
void AddElement(int v); //add a number at the end of the list
void AddElement(int v,int p); // insert a number v at position p
void Sort(); // sorts all the numbers in the list
int *Retrieve(); // returns the pointer of “a”
List operator++(); // increate all the numbers in the list by 1
List operator--(); // decrease all the numbers in the list by 1
List operator+(int n); // increase all the numbers in the list by n
List operator-(int n); // decrease all the numbers in the list by n
List operator=(List l); // creates a duplicate list of l
friend List Combine(List l1,List l2); // creates and returns a new list, merging L1 and L2, so that the numbers in new list is sorted
}
------------------------------------------------------------------------------
List :: List()
{
}
List :: List(int n)
{
}
List :: List(List l)
{
}
List :: ~List()
{
}
void List :: AddElement(int v)
{
}
void List :: AddElement(int v,int p)
{
}
void List :: Sort()
{
}
int *Retrieve()
{
}
List List :: operator++()
{
}
List List :: operator--()
{
}
List List :: operator+(int n)
{
}
List List :: operator-(int n)
{
}
List List :: operator=(List l)
{
}
List Combine(List l1,List l2)
{
}
-
April 1st, 2011, 12:32 PM
#2
Re: Help writing Functions
You won't find how to write every function online. You need to study your text and understand how lists work. Nobody here will do your homework for you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|