Question: C++ How to sort vector of tuples in a specific way. I have a vector of tuple to specify : vector>,string,string,int,double> Sorting should be accordingly:

C++ How to sort vector of tuples in a specific way.

I have a vector of tuple to specify : vector>,string,string,int,double>

Sorting should be accordingly:

1. if the 3rd argument of the tuple(string) is equal to a specific type string like "computer", sort it accordingly.

2. if the 5th argument of the tuple(double) is smaller than the other tuples with the specific 3rd argument string type, sort it accordingly.

So it should be sorted accordingly for the 3rd and 5th arguments.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!