Hour averaging program I am looking for tips on improving my short program.  I am using system("PAUSE") because this was for an assignment. 



Code:

#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;iomanip&gt;
using namespace std;

void Display(string* , int* , double*, int);
void Percentage(int*, double*, int);
void Intro(string*, int*, int&amp;);
void Highest(int&amp;, string&amp;, double*, string*, int);

int main()
{
    int students;
    string names[10];
    int hours[10];
    double percents[10];
    int highest;
    string most;


    Intro(names, hours, students);

    Percentage(hours, percents, students);
    Display(names, hours, percents, students);

    Highest(highest, most, percents, names, students);

    system("PAUSE");
}


void Intro(string* names, int* hours, int&amp; students)
{
    int team;
    cout &lt;&lt; "A team is made up of atleast 2 students. How many students are on the team?: ";
    cin &gt;&gt; team;

    cout &lt;&lt; "Enter student's first name and the hours worked on the final project: " &lt;&lt; endl;

    for (int i = 0; i &lt; team; i++)
    {
        cout &lt;&lt; i + 1 &lt;&lt; ": ";
        cin &gt;&gt; names[i] &gt;&gt; hours[i];
    }

    students = team;
}

void Display(string* names, int* hours, double* percent, int students)
{
    cout &lt;&lt; setw(20) &lt;&lt; "Students";
    cout &lt;&lt; setw(20) &lt;&lt; "Hours Worked";
    cout &lt;&lt; setw(20) &lt;&lt; "% of Total Hours";
    cout &lt;&lt; endl;
    cout &lt;&lt; "------------------------------------------------------------" &lt;&lt; endl;
    for (int i = 0; i &lt; students; i++)
    {
        cout &lt;&lt; setw(20) &lt;&lt; names[i];
        cout &lt;&lt; setw(9) &lt;&lt; hours[i];
        cout &lt;&lt; setw(16) &lt;&lt; percent[i];
        cout &lt;&lt; endl;
    }
}


void Percentage(int* hours, double* percent, int students)
{
    int total(0);

    for (int i = 0; i &lt; students; i++)
    {
        total += hours[i];
    }

    for (int i = 0; i &lt; students; i++)
    {
        percent[i] = double(hours[i]) / total * 100;
    }
}

void Highest(int&amp; highest, string&amp; most, double* percent, string* names, int students)
{
    highest = percent[0];

    for (int i = 0; i &lt; students; i++)
    {
        if (highest &lt; percent[i])
        {
            highest = percent[i];
            most = names[i];
        }
    }

    cout &lt;&lt; most &lt;&lt; " worked the most hours." &lt;&lt; endl;
}
I assume you'll have no more than 10 names/hours/percents, but you could use an std::vector in place of these arrays.  This will allow you any number of inputs without fear of exceeding the allotted 10.  If you don't need this for your assignment, then you can stick with what you have.
If you're allowed to use more of the STL, I'd recommend std::accumulate for summing up the values in a container.

For instance, your first loop in Percentage():

for (int i = 0; i &lt; students; i++)
{
    total += hours[i];
}


can be done with this function as such (with the array):

// the 10 corresponds to the array size
// the 0 is the starting value of the accumulator

int total = std::accumulate(hours, hours+10, 0);


If you choose to use std::vector (or other STL container):

// functions cbegin() and cend() return const iterators

int total = std::accumulate(hours.cbegin(), hours.cend(), 0);

I'd slightly tweak the percentage calculation for clarity:

percent[i] = (double(hours[i]) / total) * 100;

Prefer to cast the C++ way:

// C way
double(hours[i])




// C++ way
static_cast&lt;double&gt;(hours[i])

It seems a little weird having Highest() display something.  You could instead return most, thereby making the function of type std::string.  That way, you can display this name from main() or wherever else.

You don't need the first two arguments.  They are passed in from main(), but also not modified by any previous functions.  I'd remove those two and just use local variables.

highest should be of type double since it's being assigned to a percent element.  Otherwise, you may receive a "possible loss of data" warning.  This is especially important for when the two values are being compared in the loop.

You could then have this:

// get the name
std::string most = Highest(percents, names, students);

// display it
std::cout &lt;&lt; most &lt;&lt; " worked the most hours." &lt;&lt; std::endl;




std::string Highest(double* percent, string* names, int students)
{
    double highest = percent[0];
    std::string most;

    for (int i = 0; i &lt; students; i++)
    {
        if (highest &lt; percent[i])
        {
            highest = percent[i];
            most = names[i];
        }
    }

    return most;
}