jeudi 10 septembre 2020

Sorting set elements in lexographical order c++

I know that c++ set keeps its elements sorted, how can i make it sort in lexographical order? the problem im facing is: if i try to add the elements : [K1,K2,K10] for example, after the set sorts them as strings they get the following order: K1 K10 K2 which is incorrect, how can i make it sort them correctly to give me the order: K1 K2 K10 as strings.

thank you.

Aucun commentaire:

Enregistrer un commentaire