C++ Programming
04-19-2011, 04:25 PM
How to show only unique elements from this double linked list using UniqueList function? I made something, but it removes only the first...
#include "iostream"
using namespace std;
void Add(int n);
void UniqueList();
struct Elem
{
int key;
Elem *prev;
Elem *next;
} *start;
int main()
{
int num;
while(cin >> num)
{
Add(num);
}
cout key = n;
start->next = p;
start->prev = NULL;
}
void UniqueList()
{
Elem *p = start;
if(NULL != start) cout
#include "iostream"
using namespace std;
void Add(int n);
void UniqueList();
struct Elem
{
int key;
Elem *prev;
Elem *next;
} *start;
int main()
{
int num;
while(cin >> num)
{
Add(num);
}
cout key = n;
start->next = p;
start->prev = NULL;
}
void UniqueList()
{
Elem *p = start;
if(NULL != start) cout