Issue with descending order sort using pointers

#include <iostream>
#include <iomanip>

using namespace std;

void showDrr( double* drr, int size )
{
for( int i = 0; i < size; ++i )
cout << setw(8) << drr[i];
}

// Prototypes
void DrrSelectSort( double*, int );

int main()
{
cout << "How many test scores will you enter? "
<< flush;
int numTests;
cin >> numTests;
while( !cin.good() || numTests < 1 || numTests > 10 )
{
cout << "Enter an integer in range 1..10 : "
<< flush;
cin.clear(); // clear cin stream error flags
cin.sync(); // 'super' cin stream
cin >> numTests;
}
cin.sync();
double* testScores = new double[numTests];

cout << "Enter the test scores below.\n";
double sumTestScores = 0.0;
for( int super = 0; super < numTests; ++super )
{
cout << "Test Score " << (super + 1)
<< ": " << flush;
cin >> testScores[super];


while( !cin.good() ||
testScores[super] < 0.0 ||
testScores[super] > 100.0 )
{
cout << "Valid score range is 0..100"
<< " Please enter again: ";
cin.clear();
cin.sync();
cin >> testScores[super];
}
cin.sync();
sumTestScores += testScores[super];
}

// Display the results
cout << "\nYou entered testScores: \n";
cout << fixed << showpoint << setprecision(2);
showDrr( testScores, numTests );

cout << "\nThe average score is "
<< sumTestScores / numTests << endl;

//Display the Test Scores in descending order
cout << "The test scores, sorted in descending "
<< "order, are: \n";

DrrSelectSort( testScores, numTests );
showDrr( testScores, numTests );

// Free dynamically allocated memory ...
delete [] testScores;
testScores = 0; // make testScores point to null

// to keep window open until 'Enter' pressed
cin.get();
}
// This function performs an ascending order
// selection sort
void DrrSelectSort( double* drr, int size )

{
}

Any help would be great it complies but at the end does not sort in descending order for some reason..Thanks for the help!
1
2
3
4
5
// This function performs an ascending order
// selection sort
void DrrSelectSort( double* drr, int size )
{
}


Descending or ascending, I think you actually need to sort it before you complain about it not being sorted.


Descending order and that is where i am having the current trouble
Topic archived. No new replies allowed.