#include "stdstuff.h" #include "IntBag.h" // note that the constructor and size are not mentioned here as their // implementations are completely specified in the header file // constructs a bag having "value" copies of "value". // Quits if value is negative or higher than MAXVALUES. IntBag::IntBag (int value) { // first check value if (value<0 || value>MAXVALUES) { *this = IntBag(); quit("IntBag::Intbag - value must be between 0 and MAXVALUES.\n"); } // value is good, so initialize fields count = value; for (int i=0; i1) result.add(value); // could also add just one copy if it occurs once // in copy, and otherwise add two copies } } // return the result return result; } // bag is less than other bag if it has fewer elements bool IntBag::operator<(const IntBag &otherBag) const { return count