Hi,
I have a parallel array of size 10 with several different size numbers in them.
Within my program I put a series of cout statments for the different array indexes so that was known, and here they are:
cout << classes[0] << " " << boxes[0] << endl;
.
.
cout << classes[9] << " " << boxes[9] << endl;
The code actually showed indexes 0 through 9, and here is the output:
3 80
4 234
2 54
1 78
10 142
5 87
6 34
7 98
8 43
9 62
Okay, the first column is the numbers assigned to people, the second column is the amount of money the people have, each person is assigned a number.
What I am looking to do is print the number of the person with the most money.
I have written this code:
largest = money[0];
for(m=0;m<10;m++)
{
if(money[m] > largest)
largest =money[m];
}
Although this code will print the highest dollar, I am lacking the understanding of how to print the corresponding index value of the person containing that highest amount of money...
Would anybody be able to please lend me a tip?
Thank you