2 Structs into a function gives me some problems.

Hi! I'm creating a list that worked great! But now i would like to add imaginary numbers to my singel linked list as well, so i created another struct which gives me some problems. Anyone know what it is?

I have deleted away a lot of lines just to make it easier to read, i have as well commented it away in originally code for now. What i think i do wrong is either this line "insert(list,value);" or "list->data.real > value.real"


1
2
3
4
5
6
7
8
9
struct Complex
{
  int real, imag;
};

struct List_Type{
  Complex data;
  List_Type *next;
};


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
bool insert(List_Type *&list,Complex value);
int main ()
{

  List_Type *list;
  list = nullptr;

  Complex value;

  int reall = 0;
  int img = 0;

  cout << "Enter the data: " ;
  cin >> reall;
  value.real = reall;
  cin >> img;
  value.imag = img;
  insert(list,value);
}

void insert(List_Type *&list,Complex value)
{
if (list == nullptr || list->data.real > value.real)
	{
	  cout << "TEST"; 
        }

}
So what's the problem? Compiler error? Is it not doing what you expect?
Yeah sorry i forgot to mention that. It gives me Compile errors:

I have everything in different files (in my originally text) but when i copy the text above it seems to work. So i guess it must be something that I'm including wrong then :/ Have been trying to fix this for last 3 hours and since i had never used two different structs i thought it had to be something wrong whit that.

Sorry :( Will try to see what i have done in my other 3 files and come back later maybe then.
It gives me Compile errors


... so what are they?
Topic archived. No new replies allowed.