0

Question- List the passengers sorted by highest number of bookings.

  void defaultvalue(vector<indi>&a)
    {
        a.push_back(indi("Kobe","17-05-2015","KUL","SIN"));
        a.push_back(indi("Kobe","14-04-2015","KUL","HKG"));
        a.push_back(indi("David","08-04-2015","JED","HKG"));

how can i implement the count and sort part..by using algorithm.. and show Kobe 1st and follow by david depends on number of booking ... please any 1 can help me..

Suen
  • 1
  • 3
  • 1
    Your code sample is incorrect (does not compile) and your question is far from clear. – Bruce Jul 28 '15 at 13:31

1 Answers1

0

Look at std::sort, you can specify a compare function (or functor) to std::sort.
Therefore, you can write up a function that does compare two "pas" objects in the way you want.

Richard Dally
  • 1,432
  • 2
  • 21
  • 38
  • can u give me a simple example.. haha.. im beginner for this subject..please please TT – Suen Jul 28 '15 at 13:36