array- football team management system

i need to display the player with the lowest and highest min of play and lowest and highest bonus..i already do the coding but it doesn't display the output that i want..after entering all the player's profile, i need to display the player with the lowest and highest min of play and lowest and highest bonus but the problem with my code is, it display after i enter the first player's profile.


#include <iostream>
using namespace std;

int main()
{
string name[3];
string position[3];
int age[3];
int weight[3];
int height[3];
string nationality[3];
int min[3];
int goal[3];
int bonus[3];
int total;
int highMin, lowMin, highBonus, lowBonus;

cout << "\t\tFootball Team Management System" << endl << endl;
cout << " Player's profile" << endl;

for (int i=0; i<3; i++)
{
cout << "Name : ";
cin >> name[i];
cout << endl;
cout << "Position : ";
cin >> position[i];
cout << endl;
cout << "Age : ";
cin >> age[i];
cout << endl;
cout << "Weight : ";
cin >> weight[i];
cout << endl;
cout << "Height : ";
cin >> height[i];
cout << endl;
cout << "Nationality : ";
cin >> nationality[i];
cout << endl;
cout << "Minutes played this week : ";
cin >> min[i];
cout << endl;
cout << "Goals scored this week : ";
cin >> goal[i];
cout << endl;

bonus[i] = ((100 * min[i]) + (500 * goal[i]));

cout << "Bonus : " << bonus[i] << endl << endl;

total = total + bonus[i];
cout << "Total : " << total << endl;

lowMin = min[0];
if (min[i] < lowMin)
{
lowMin = min[i];
}
cout << name[i] << " has the lowest minutes of play" << endl;

if (min[i] > highMin)
{
highMin = min[i];
}
cout << name[i] << " has the highest minutes of play" << endl;

lowBonus = bonus[0];
if (bonus[i] < lowBonus)
{
lowBonus = bonus[i];
}
cout << name[i] << " has the lowest bonus" << endl;

highBonus = bonus[0];
if (bonus[i] > highBonus)
{
highBonus = bonus[i];
}
cout << name[i] << " has the highest bonus" << endl;
}
return 0;
}
closed account (48T7M4Gy)
http://www.cplusplus.com/forum/general/202837/
Topic archived. No new replies allowed.