operator + for linked list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

operator + for linked list

the operator must return the fusion of the two list but when the items are the same valuer only shows in the returned list. i did i for to scroll through the first list while the next pionter is null but it does get out of the for. I try to change it to a while and happened the same thing. The code is in portuguese so i didn't put it here. Sorry for my bad english and if the explanation isn't clear enough.

6th May 2021, 8:30 PM
CiberNinja
CiberNinja - avatar
8 Answers
+ 2
CiberNinja Yes, put all of your files here. Or if you can merge them into one.
6th May 2021, 11:38 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
The definition about doing what for the same value + is unclear. For example: what is {1, 3, 5} + {5, 4, 3} ? Another thing is that without your code we can't really help, especially everyone has their way to implement linked list.
6th May 2021, 10:55 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
CarrieForle Sorry to have taking do long but it was late here. Heres my code: https://code.sololearn.com/ca192a81A23A/?ref=app I try to comment in english so it can help you undertand it. Thanks again
7th May 2021, 7:05 AM
CiberNinja
CiberNinja - avatar
+ 1
Martin Taylor thanks for the help. I will have a look at links
7th May 2021, 9:15 AM
CiberNinja
CiberNinja - avatar
+ 1
Martin Taylor i look at the links and gave more information about linked lists. Thanks! But for this code i need to find a way of doing the operator + with yhe methods that i have
7th May 2021, 7:52 PM
CiberNinja
CiberNinja - avatar
0
The example woudl be: {1,3,5,4} I will try put the code here but i have more them one file so i might need to put it all right? And thanks for trying to help
6th May 2021, 10:59 PM
CiberNinja
CiberNinja - avatar
0
I think i figure out my problem. Someone knows how can i pass the head of the new list to the class CListaInteiros? I try by pointer but no luck. I try to do: CListaInteiro *prt_new = novo.cabeca (the head of the new list ) and them retun prt_new but it was an erro
8th May 2021, 8:14 PM
CiberNinja
CiberNinja - avatar
0
Thanks everyone who try to help! I end up founding my mistake :)
12th May 2021, 12:48 PM
CiberNinja
CiberNinja - avatar