Overloading the plus operator for linked lists(binary numbers)

Pages: 12
What if you display it in cout instead of outfile ?

Can you try to execute the code I posted instead of yours ? It will help us know if the problem comes from the code.
Just replace outfile with cout? My screen is blank.
I have no more ideas.
If you can use a debugger, you could start by looking why your operator<< doesn't output anything.
Could you provide steps for the debugger? :)
Put a breakpoint in your operator<<() function on line current=outclass.head_ptr;.

Run your application and when the program stops on the breakpoint, check that outclass.head_ptr is not null.

If outclass.head_ptr is not NULL, I have no explanation for what's happening. Try rebooting your PC or changing your compiler.

If it's NULL your "binary" object is empty. That means you have to check operator>>() and operator+().
Try 11101 + 1101 with your code though. It won't equal what it's supposed to.

This means that there is something wrong with adding the carry. I will look into this more.
Last edited on
I cut my computer off and it works! Thanks for your help!
Topic archived. No new replies allowed.
Pages: 12