Lab12 - File Handling
Lab12 - File Handling
CODE:
team.h
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
using namespace std;
class Player {
public:
string name;
int matches;
int runs;
double strike_rate;
int fifties;
int hundreds;
int balls_bowled;
int wickets;
};
class team {
public:
// Team attributes
string team_name;
vector<Player> players;
int captain_index;
// Team methods
void print_data() const;
void set_team_name(string& name);
string get_team_name() const;
bool addPlayer(const Player& player);
bool replacePlayer(int index, const Player& player);
bool swapPlayerOrder(int index1, int index2);
void build(const std::string& file_path);
private:
Player best_batsman;
Player best_bowler;
};
team.cpp
#include "team.h"