- #1

heavyc

- 16

- 0

#include <iostream>

using namespace std;

struct node {

int data;

node *next;

};

struct node *push_front ( node *list, int data )

{

node *p = new node;

p->data = data;

p->next = list;

list = p;

return list;

}

int main()

{

node *list = 0;

node *save;

for ( int i = 0; i < 10; i++ )

list = push_front ( list, rand() % 5 + 1 );

while ( list != 0 ) {

save = list->next;

cout<< list->data <<' ';

delete list;

list = save;

}

cout<<'\n';

}

and here is what i am trying to put in.., i have it written but i don't know what varibles to put and where to put it into the program..

for ( i = first; i != last; i = next ( i ) ) {

for ( j = next ( i ); j != last; j = next ( j ) ) {

if ( i == j )

unlink ( j );

}

}