#include <iostream>
#include <string>
#include <vector>
using namespace std;
// OrinTill Qimid CS1A Chapter 4, P. 294, 10
//
// /**************************************************************
// * Entry for Players.
// *
// * ____________________________________________________________
// * This program will display player stats.
// * ____________________________________________________________
// * INPUT
// * Player stats
// * OUTPUT
// * Displaying player stats.
// **************************************************************/
// Define the MonthlyBudget structure
struct Player {
string name;
int number;
int points;
};
int main() {
const int TEAM_SIZE = 12;
vector<Player> team(TEAM_SIZE);
int totalPoints = 0;
Player topPlayer;
topPlayer.points = -1; // Initialize with a value lower than any expected score
// Input player details
for (int i = 0; i < TEAM_SIZE; ++i) {
cout << "Enter details for player " << (i + 1) << ":\n";
cout << "Name: ";
cin >> team[i].name;
cout << "Number: ";
cin >> team[i].number;
cout << "Points Scored: ";
cin >> team[i].points;
cout << "\n";
totalPoints += team[i].points;
if (team[i].points > topPlayer.points) {
topPlayer = team[i];
}
}
// Display player details
cout << "\nTeam Players:\n";
cout << "Number\tName\tPoints\n";
for (const auto& player : team) {
cout << player.number << "\t" << player.name << "\t" << player.points << "\n";
}
// Display total points and top player
cout << "\nTotal points scored by the team: " << totalPoints << "\n";
cout << "Top player: " << topPlayer.name << " (Number: " << topPlayer.number << ") with " << topPlayer.points << " points.\n";
return 0;
}