Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ PROGRAM I HAVE INCLUDED ALL OF THE FILES BELOW. PLEASE MAKE SURE THAT PROGRAM RUNS CORRECTLY. bag.h : http://pastebin.com/MCnFmZzF bag.cpp : http://pastebin.com/r7skEXvn bag_diff3.cpp :
C++ PROGRAM I HAVE INCLUDED ALL OF THE FILES BELOW. PLEASE MAKE SURE THAT PROGRAM RUNS CORRECTLY.
bag.h: http://pastebin.com/MCnFmZzF
bag.cpp: http://pastebin.com/r7skEXvn
bag_diff3.cpp: http://pastebin.com/MAJ5AZjK
1. A Different dynamic bag (50 points) For dynamic bag, implement the operators -- and - for the class These operators compute the difference between two bags. In summary bl-b2 results in a bag that has the elements of bl with the elements of b2 removed. For example, if bl has eight 4's in it and b2 has five 4's in it then bl-b2 has three 4's in it. o Ifb2 has more of an element than bl, it is not an error. The difference simply ends up with none of that element. o For example, if bl has five 4's in it and b2 has eight 4's in it then bl-b2 has no 4's in it. Implement-= as a member function and-as a non-member function (similar to += and +). Here are the two headers from bag.h: o void operator -(const bag &subtrahend); o bag operator- (const bag& bl, const bag & b2); o The program bag diff3.cpp provide a basic check of the two new operatorsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started