Hello:
I have a txt file of many names, they arranged randomly. Say they are:
XYZ
ACD
ABC
OPQ
RST
Now I want to re-arrange them alphabetically as:
ABC
ACD
OPQ
RST
XYZ
How to do this, please! --Zhao
Printable View
Hello:
I have a txt file of many names, they arranged randomly. Say they are:
XYZ
ACD
ABC
OPQ
RST
Now I want to re-arrange them alphabetically as:
ABC
ACD
OPQ
RST
XYZ
How to do this, please! --Zhao
Insert them into std::set (elements are stored sorted) and then iterate through its elements.
What you're looking for is called "sorting".
Hi: Not using the sort skill before, I don't know how to start.
Could you tell me something more?
A quick search turns up this as a possible starting point.
See how you go with adapting the information there to what you have.
In your next post, be sure to include some code showing the definition of the struct or type of data that you are sorting.