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.
解决方案It looks like you did not really got to the idea of the value of home assignment, not yet. Here is a hint for your: home assignments are very valuable. If you have to pay for education, please understand: this is perhaps most valuable part of your school activity worth paying for. If you do not do your home assignment 100% by yourself, this is the same as flushing money down the toiled. And you don''t want it.
So, I suggest we give you another chance to use the opportunities your school gives you.
Good luck,
—SA