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
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".
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
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.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"