#ifndef INGREDIENT_H #define INGREDIENT_H #include class Ingredient { public: Ingredient(std::string tname,int tunits); //Destructers ~Ingredient() {}; int getUnits() const; void setUnits(int tunits); std::string getName() const; void setName(std::string tname); void RemoveUnits(int); private: int units; std::string name; }; void Ingredient::setName(std::string tname) { name=tname; } void Ingredient::setUnits(int tunits) { units=tunits; } void Ingredient::RemoveUnits(int unit) { units=units-unit; } Ingredient::Ingredient(std::string tname,int tunits) { units=tunits; name=tname; } int Ingredient::getUnits() const { return units; } std::string Ingredient::getName() const { return name; } //Sort helper functions bool operator<(Ingredient &ing1,Ingredient &ing2) { if(ing1.getUnits() > ing2.getUnits()) return false; if(ing1.getUnits() == ing2.getUnits() && ing1.getName() > ing2.getName()) return false; return true; } bool sortabc(Ingredient &ing1,Ingredient &ing2) { if(ing1.getName() > ing2.getName()) return false; return true; } #endif