#include "stdafx.h"
#include <iostream>
#include <iomanip>
usingnamespace std;
struct PlayerInfo
{
char name[10];
double playerID;
double points;
};
int main()
{
constint SIZE = 3;
PlayerInfo soccer[SIZE];
cout << "Enter the player information below\n";
cout << "----------------------------------\n";
for( int i = 0; i < SIZE; i++)
{
cout << "\nEnter the player #" << ( i + 1 ) << " name: ";
cin >> soccer[i].name;
cout << "Enter the player jersey number: ";
cin >> soccer[i].playerID;
while ( soccer[i].playerID < 0 )
{
cout << "Please enter a number greater than zero: ";
cin >> soccer[i].playerID;
}
cout << "Enter the points scored by player #" << ( i + 1 ) << ": ";
cin >> soccer[i].points;
while ( soccer[i].points < 0 )
{
cout << "Please enter a number greater than zero: ";
cin >> soccer[i].points;
}
}
//cout << "Total points combine is: \n";
//cout << fixed << showpoint << setprecision(2);
for ( int i = 0; i < SIZE; i++ )
{
double total = 0;
total = soccer[i].points + total;
cout << "Total points combine for the team: " << total << endl;
// this is where i try to find the highest points scored by a player
// and try to display his jersey number and name
int max;
max = soccer[i].points;
for ( int j = 0; j < SIZE; j++ )
{
if (soccer[i].points > max )
max = soccer[i].points;
cout << "The player that scored that highest points is: " << max << endl;
}
}
return 0;
}