linked list

I have made two linked lists now i want to combine the two lists but i get an error that , i can't assign value of one stack object to another stack object is there a way around this . Here's a sample code.

1
2
3
4
5
6
7
8
9
10
11
12
  void Append()
{
	 list1 *temp1;
	 list2* temp2;
	temp2=front2;
	temp1=front;

	while(1)
	{
		if(temp1->next==NULL){
			temp1->next=temp2;
		
> Here's a sample code.
A testcase is said to reproduce the problem if, when we independently try to compile and run the testcase locally, we get the same compiler error (or our compiler's version of it) or erroneous program output specified in the testcase. A testcase that does not reproduce the problem is useless

A testcase consisting of randomly copy&paste'd bits of code that you thought were relevant can obviously not reproduce the problem.
http://www.eelis.net/iso-c++/testcase.xhtml
Yes sorry , I did want to write at the end if whole code needed will be pasted but i thought it will get messier , anyway here is the code the problem i am having is only in the Append(); funciton
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
struct queue
{
	int data;
	queue * next;

}* front=NULL;
queue*rear=NULL;
queue list1;
queue list2;

void insert(int val)//as a PUSH function
{
	queue * newNode = new queue;
	list1.data=10;
newNode->data = val;
  newNode->next = NULL; 
  if(rear == NULL){
     front = rear = newNode;

  }
  else{
     rear->next = newNode;
     rear = newNode;

  }
}

void del()//as a POP function
{
	

  queue * temp = front;
  if(front == NULL){
     cout<<"Queue Empty";
  }
  else if(front == rear){
     cout<<"Item deleted";
     front = rear = NULL;
     delete temp;
  }
  else{
     cout<<"Item deleted";
     front = front->next;
     delete temp;

}
}
void Display()
{
	queue * head;
head=front;
while (head!= NULL) 
{
	cout<< head->data;
	head = head->next;
}

}
void main()
{
	insert(5);
	insert(6);
	insert(7);
	del();
	
	Display();
getch();
}
Topic archived. No new replies allowed.