Links to my code, did not use the code tags here because there are a lot of files... The links are in c++ syntax. This is my first post.
node.h
http://pastebin.com/3jrnNN5p
main.cpp
http://pastebin.com/LAa1tpi2
node.cpp
http://pastebin.com/GxYmne1L
bag.cpp
http://pastebin.com/Zup91snh
bag.h
http://pastebin.com/evdxtSx8
I have all of these files for my c++ homework and I am having trouble overloading the - and -= operators to use in my bags x and y. The homework states that we must do it like this;
For two bags x and y. The bag x-y contains all the items of x, with any items from y removed. For example, suppose that x has seven copies of the number 3, and y has two copies of the number 3 (ie 7-2 copies of the number 3). In the case where y has more copies of an item than x does, the bag x-y will have no copies of that item. The statement x -= y should have the same effect as the assignment x = x-y.
Does anyone know how this would be done? Maybe some examples using my code? Thanks, I do not wish for you to write the 2 overloading functions for me. If you are willing then by all means go ahead, but if you do try to explain it to me.