c++ array list
-
i am a new C++ programmer and would like to implement an array based list for 100 integers and would also want to sort them by any integer of my choice. snyboy with an with an idea on how to go about this? :(( :((
phokojoe
for the array what about :
int myArray[100];
or (way better, easier for sorting)std::vector myVector; myVector.reserve(100);
// optional -
for the array what about :
int myArray[100];
or (way better, easier for sorting)std::vector myVector; myVector.reserve(100);
// optionalMaximilien wrote:
int myArray[100]; or (way better, easier for sorting) std::vector myVector; myVector.reserve(100); // optional
Why do you think sorting a std::vector is easier?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Maximilien wrote:
int myArray[100]; or (way better, easier for sorting) std::vector myVector; myVector.reserve(100); // optional
Why do you think sorting a std::vector is easier?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]CPallini wrote:
Why do you think sorting a std::vector is easier?
because someone though of writing the std::sort() algorithm maybe...?! ;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
CPallini wrote:
Why do you think sorting a std::vector is easier?
because someone though of writing the std::sort() algorithm maybe...?! ;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
someone else possibly though of writing
qsort
;PIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
someone else possibly though of writing
qsort
;PIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Yes, but std::sort() algorithm is faster than qsort!
A C++ programming language novice, but striving to learn