I'm outputting a two-dimensional array with a for loop like this:
void output(int data[50][8], string names[50]) {
    int amount = 0;
    amount = fillAndDisplay(data, names);`
    for (int i = 0; i < amount; i++) {
        cout << names[i] << " ";
        for (int j = 0; j < 8; j++) {
            cout << data[i][j] << " ";
        }
        cout << endl;
    }
    return;
}
amount will equal 5 in my case.
Now, right now I'm returning data and names, but it's not working. What do I need to return? Also, what data type should I use for the function? I'm using void right now, but I'm not sure if that's correct.
Here's my full code. The file that it's reading in is:
5 
Franks,Tom 2 3 8 3 6 3 5 
Gates,Bill 8 8 3 0 8 2 0 
Jordan,Michael 9 10 4 7 0 0 0 
Bush,George  5 6 5 6 5 6 5 
Heinke,Lonnie  7 3 8 7 2 5 7
Here's the code:
int fillAndDisplay(int data[50][8], string names[50]);
void sort(int data[50][8], string names[50]);
void output(int data[50][8], string names[50]);
int main()
{
int data[50][8];
string names[50];
int amount = 0;
 amount = fillAndDisplay(data, names);
 sort(data, names);
 output(data, names);
system("pause");
return 0;
}
int fillAndDisplay(int data[50][8], string names[50]) {
int const TTL_HRS = 7;
ifstream fin;
fin.open("empdata.txt");
if (fin.fail()) {
    cout << "ERROR";
}
int sum = 0;
int numOfNames;
fin >> numOfNames;
for (int i = 0; i < numOfNames; i++) {
    fin >> names[i];
    data[i][7] = 0;
    for (int j = 0; j < 7; j++) {
        fin >> data[i][j];
        data[i][TTL_HRS] += data[i][j];
    }
}
return numOfNames;
}
void sort(int data[50][8], string names[50]) {
int amount = 0;
int temp = 0;
bool hasSwapped = true;
string tempName;
amount = fillAndDisplay(data, names);
while (hasSwapped) {
    hasSwapped = false;
    for (int i = 0; i < amount - 1; ++i)
    {
        if (data[i][7] < data[i + 1][7]) {
            for (int j = 0; j <= 7; j++) {
                temp = data[i][j];
                data[i][j] = data[i + 1][j];
                data[i + 1][j] = temp;
            }
            tempName = names[i];
            names[i] = names[i + 1];
            names[i + 1] = tempName;
            hasSwapped = true;
        }
    }
}
}
void output(int data[50][8], string names[50]) {
int amount = 0;
amount = fillAndDisplay(data, names);
for (int i = 0; i < amount; i++) {
    cout << names[i] << " ";
    for (int j = 0; j < 8; j++) {
        cout << data[i][j] << " ";
    }
    cout << endl;
}
}
When The code to print out the arrays is in a function it prints out:
Franks,Tom 2 3 8 3 6 3 5 30
Gates,Bill 8 8 3 0 8 2 0 29
Jordan,Michael 9 10 4 7 0 0 0 30
Bush,George 5 6 5 6 5 6 5 38
Heinke,Lonnie 7 3 8 7 2 5 7 39
Press any key to continue . . .
but when the code is just in main it prints out
Heinke,Lonnie 7 3 8 7 2 5 7 39
Bush,George 5 6 5 6 5 6 5 38
Jordan,Michael 9 10 4 7 0 0 0 30
Franks,Tom 2 3 8 3 6 3 5 30
Gates,Bill 8 8 3 0 8 2 0 29
Press any key to continue . . .
Which is what it should print out.
