0

I completed most of the functions and it compiles but need help with two.Can someone help me with the uniqueScore function which is suppose to print test scores that only appears once and the differenceScore function which is suppose to print the difference between the largest and smallest score.

```
#include <iostream>
using namespace std;
#include <fstream>
void loadArray ( int intscores[], int numScores );
void printScores ( int intscores[], int numScores);
void computeAverage ( int scores, int numScores, double & average);
void greaterAverage ( int intscores [], int numScores, double & average);
void uniqueScores ( int scores, int numScores);
void largestScore ( int intscores[], int numScores, double largest);
void smallestScore ( int intscores[], int numScores, double smallest);
void differenceScore ( int scores, int numScores);
int main ()
{
//declare variables
int scores;
int numScores;
double largest;
double smallest;
double average;
}
//loads data from file
void loadArray(int intscores[], int size)
{
ifstream infile;
infile.open("scores.dat");
size=0;
while (!infile.eof() )
{
infile >> intscores[size];
size++;
}
infile.close();
}
//prints scores
void printScores (int intscores[], int numScores)
{
cout << "printing scores" <<endl;
for (int i = 0; i < numScores; i++)
cout << intscores[i] <<endl;
}
//computes the average
void computeAverage ( int scores, int numScores, double & average)
{
average = (scores)/numScores;
}
//prints all scores greater than the average
void greaterAverage (int intscores[], int numScores, double & average)
{
cout << "printing scores greater than the average score" <<endl;
for (int i = 0; i < numScores; i++)
if (intscores[i] > average)
cout << intscores[i] <<endl;
}
//the unique test scores that appears only once
void uniqueScores (int scores, int numScores)
{
}
//prints the largest score
void largestScore (int intscores[], int numScores, double largest)
{
cout << "printing the largest score" <<endl;
largest = 0;
for (int i = 0; i < numScores; i++)
if (intscores[i] > largest)
largest = intscores[i];
}
//prints the smallest score
void smallestScore (int intscores[], int numScores, double smallest)
{
cout << "printing the smallest score" <<endl;
smallest = 0;
for (int i = 0; i < numScores; i++)
if (intscores[i] < smallest)
smallest = intscores[i];
}
//the difference between the largest and smallest score
void differenceScore (int scores, int numScores)
{
}
```

code:

```
#include <iostream>
using namespace std;
#include <fstream>
void loadArray ( int intscores[], int numScores );
void printScores ( int intscores[], int numScores);
void computeAverage ( int scores, int numScores, double & average);
void greaterAverage ( int intscores [], int numScores, double & average);
void uniqueScores ( int scores, int numScores);
void largestScore ( int intscores[], int numScores, double largest);
void smallestScore ( int intscores[], int numScores, double smallest);
void differenceScore ( int scores, int numScores);
int main ()
{
//declare variables
int scores;
int numScores;
double largest;
double smallest;
double average;
}
//loads data from file
void loadArray(int intscores[], int size)
{
ifstream infile;
infile.open("scores.dat");
size=0;
while (!infile.eof() )
{
infile >> intscores[size];
size++;
}
infile.close();
}
//prints scores
void printScores (int intscores[], int numScores)
{
cout << "printing scores" <<endl;
for (int i = 0; i < numScores; i++)
cout << intscores[i] <<endl;
}
//computes the average
void computeAverage ( int scores, int numScores, double & average)
{
average = (scores)/numScores;
}
//prints all scores greater than the average
void greaterAverage (int intscores[], int numScores, double & average)
{
cout << "printing scores greater than the average score" <<endl;
for (int i = 0; i < numScores; i++)
if (intscores[i] > average)
cout << intscores[i] <<endl;
}
//the unique test scores that appears only once
void uniqueScores (int scores, int numScores)
{
}
//prints the largest score
void largestScore (int intscores[], int numScores, double largest)
{
cout << "printing the largest score" <<endl;
largest = 0;
for (int i = 0; i < numScores; i++)
if (intscores[i] > largest)
largest = intscores[i];
}
//prints the smallest score
void smallestScore (int intscores[], int numScores, double smallest)
{
cout << "printing the smallest score" <<endl;
smallest = 0;
for (int i = 0; i < numScores; i++)
if (intscores[i] < smallest)
smallest = intscores[i];
}
//the difference between the largest and smallest score
void differenceScore (int scores, int numScores)
{
}
```

*Edited 4 Years Ago by mike_2000_17*: Fixed formatting