Ascending order
-
std::sort
does sorting. The easy version uses your test scores' operator< for determining sort order. It gets a little more complex if you want to sort by other orders. Or do I misunderstand your question?
Who is 'General Failure'? And why is he reading my harddisk?!?
-
std::sort
does sorting. The easy version uses your test scores' operator< for determining sort order. It gets a little more complex if you want to sort by other orders. Or do I misunderstand your question?
Who is 'General Failure'? And why is he reading my harddisk?!?
dynamicall allocate an array large enough to hold any number of test scores to user wishes to enter. the array should then be passed to a function that sort them in ascending order. I can use std:sort under namespace std; to do that. I thought a num++ or num-- or a if statement? confused on what to do
-
dynamicall allocate an array large enough to hold any number of test scores to user wishes to enter. the array should then be passed to a function that sort them in ascending order. I can use std:sort under namespace std; to do that. I thought a num++ or num-- or a if statement? confused on what to do
iasaber wrote: I thought a num++ or num-- or a if statement num++/num-- do increase/decrease num. They do not change their position in the array! To do that you need to copy one array member to a local variable, copy the one to exchange to its position and copy your local copy to the position where the other one has been. Dynamical allocation of your array can be done by the STLs std::vector, but I think the point is you learning to handle objects ;-)
Who is 'General Failure'? And why is he reading my harddisk?!?
-
Have you looked at
qsort()
?
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?