I am not really sure how to get this accomplished.
Here is, first, my header file.
// Test Scores function specification file
#ifndef TEST_SCORE_H
#define TEST_SCORE_H
// Test Score class declaration
class TestScore
{
private:
int *numTests; // Holds number of tests
double *scoreArray; // Dynamic array for test scores
double testAverage; // Holds the average of tests
double score; // Holds a score value
double *testPtr; // Pointer
scoreArray = new double[numTests]; // Array that holds test scores
testPtr = scoreArray; // Assign the array address
public:
TestScore(); // Defualt constructor
double setScore(double value); // Stores the score value
double getScore(); // Returns a stored scored value
double setNumScore(int amount); // Stores the amount of tests
double getNumScore(); // Returns the amount of tests
double getAverage(); // Gets the average test score
void sort(scoreArray array[], int); // Sorts the array
void showScores(testPtr, int); // Displays the array values
};
#endif
And here is the code snippet for the sorting function:
/******************************************
sort
Sorts the contents of TestScores array into
ascending order
*******************************************/
void TestScore::sort(scoreArray array[], int size)
{
TestScore temp; // Holds temporary object
bool swap;
do
{
swap = false;
for(int count = 0; count < (size - 1); count++)
{
if(array[count].getScore() > array[count + 1].getScore())
{
temp = array[count];
array[count] = array[count + 1];
array[count + 1] = temp;
swap = true;
}
}
}while(swap);
}
The error I am getting for the function is that the scoreArray is not a type name. Not sure what is going on here. Any help will be appreciated a lot.
Thanks :-)

New Topic/Question
Reply




MultiQuote





|