Is it even possible to sort a string vector?
i have 4 vectors:
player1
player2
player3
player4
each vector has 13 random playing cards in them, in this format:
A H
4 C
3 S
etc..
basically its [value (2-9, T-A, T = ten J Q K A][space][suit (C H S D)]
and i need to sort the cards from highest to lowest in the vector - the suit doesn't matter just as long as A is highest, then K Q J T 9 8 7 6 5 4 3 2. I've googled it and came across http://www.cplusplus.com/forum/general/3605/ but i do not understand anything in it. is there a more simple way of sorting a string vector? and the reason it wasn't an int vector is because then i cant store the letters in it. thanks if anyone knows.
You can define your own function used to compare the elements in the vector ( It should return true if the 1st argument is smaller than the 2nd ) and use the sort standard algorithm: http://www.cplusplus.com/reference/algorithm/sort/