Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "iostream"
- #include "string"
- using namespace std;
- class IceCream
- {
- public:
- string name;
- double price;
- //constructor
- IceCream(string name, double price)
- {
- this->name = name;
- this->price = price;
- }
- //we need this function to define how to sort the vector
- static bool ComparePrices(IceCream flavour1, IceCream flavour2)
- {
- return flavour1.price < flavour2.price;
- }
- static bool CompareNames(IceCream flavour1, IceCream flavour2)
- {
- return flavour1.name < flavour2.name;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement