bubble sort help!

I need help sorting an array from an input file. After reading the scores into the array from the file, use a bubble sort to sort the array and display all of the sorted scores to the screen. This is what i have so far i just don't know how to do it.

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <string>

using namespace std;

void getScores(ifstream &list, double scores[], int &size);
void fileOpen(ifstream &list);
void minScoreMaxScore(int size, double scores[]);
int main()
{

int size;
ifstream list;
double scores[10];


fileOpen(list);
getScores(list, scores, size);
minScoreMaxScore(size, scores);



system("pause");

return 0;
}

void getScores(ifstream &list, double scores[], int &size)
{
int i = 0;

do
{
list >> scores[i];
i++;
} while (list);

size = i-1;

}

void fileOpen(ifstream &list)
{
string listName;

cout << "Enter the name of the file you are trying to open: ";
cin >> listName;

list.open(listName.c_str());
assert(list);

}

void minScoreMaxScore(int size, double scores[])
{

int i;
double minScore = scores[0];
double maxScore = scores[0];
double points = 0;

for (i = 0; i < size; i++)
{
points += scores[i];

if (scores[i] > maxScore)
maxScore = scores[i];
if (scores[i] < minScore)
minScore = scores[i];

}

points = points - minScore - maxScore;
cout << fixed << setprecision(2) << "The total points received is " << points << endl;
}

Topic archived. No new replies allowed.