Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include "iostream"
  2. #include "string"
  3.  
  4. using namespace std;
  5.  
  6. class IceCream
  7. {
  8. public:
  9. string name;
  10. double price;
  11.  
  12. //constructor
  13. IceCream(string name, double price)
  14. {
  15. this->name = name;
  16. this->price = price;
  17. }
  18.  
  19. //we need this function to define how to sort the vector
  20. static bool ComparePrices(IceCream flavour1, IceCream flavour2)
  21. {
  22. return flavour1.price < flavour2.price;
  23. }
  24.  
  25. static bool CompareNames(IceCream flavour1, IceCream flavour2)
  26. {
  27. return flavour1.name < flavour2.name;
  28. }
  29. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement