I'm sorry I'm trying to understand what you're saying and trying to get it to work but I'm not understanding. Sorry.
Printable View
I'm sorry I'm trying to understand what you're saying and trying to get it to work but I'm not understanding. Sorry.
Alright, with various possibly conflicting things being said people have probably confused you, and you're over thinking things. This is about what you need I believe:Other than the ... bits, I've left one other little math problem with it for you to correct. See what values you get from that for an already sorted and a reverse sorted array.Code:template <class iterator>
int sortPercentage(iterator start, iterator finish)
{
int outOfOrder = 0;
int numPairs = ...; // Simple subtraction equation here
for (...)
{
if (... > ...)
{
outOfOrder++;
}
}
return 100 * outOfOrder / numPairs;
}