I've written the first 2 thirds of the program, but the final part seems to be escaping me.
I needed to make an array asking the user for 3 salesmen, and then ask them for quarterly earning for each salesman, before finally posting the total earned by each salesman. I got that part easily enough.
Now, though, I need to find who earned the most, per quarter, and post the best earner for each quarter.
I've been told to use if statements and for loops to find the answer, but whenever it outputs I always get "Best Earner for Q1 was [First Input Name] with 0 earnings.
Help, please?
My code for the final part is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
for (count2; count2 < QUARTERS; count2++)
{
highestSales = 0;
cout << "The highest earner for Q" << count2 + 1;
for (count1; count1 << SALES_BROS; count1++)
{
if (highestSales < salesEarned[count1][count2])
{
highestSales = salesEarned[count1][count2];
highestDude = count1;
}
}
cout << " was " << salesNames[highestDude] << " with " << highestSales << endl;
}
|
QUARTERS is hard set to 4, and SALES_BROS is hard set to 3.
count 2 is supposed to be quarters, because I figured checking each quarter was better than checking the 1/2/3/4 quarters for each salesman and then comparing.