i have this problem and i am having trouble how to incorporate another function into this problem here is the problem..(adsbygoogle = window.adsbygoogle || []).push({});

#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 dont 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 );

}

}

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Incorporate another function into this problem C++

**Physics Forums | Science Articles, Homework Help, Discussion**