Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstdlib>
- #include <ctime>
- #define MAX_SIZE 25
- #define ELEVEN 11
- //srand( time( NULL ) );
- class Person
- {
- public:
- int age;
- std::string firstName,sureName;
- public:
- Person(){}
- Person(std::string f,std::string s,int a):age(a),firstName(f),sureName(s){}
- };
- class Rating
- {
- public:
- int defending, strength, shooting, expirence;
- int offensive(){
- return shooting*0,5+strength*0,3+expirence*0,2;
- }
- int defensive(){
- return defending*0,5+strength*0,3+expirence*0,2;
- }
- };
- class Player: public Person, Rating
- {
- public:
- float value;
- int goals, assists;
- std::string position;
- public:
- Player(){}
- Player(std::string f,std::string s,std::string p, int a, float v, int g, int as):
- Person(f,s,a),position(p),value(v),goals(g),assists(as){}
- };
- class Manager: public Person
- {
- };
- class Team: public Player
- {
- public:
- Player team[MAX_SIZE];
- Player eleven[ELEVEN];
- std::string name,stadium;
- int size;
- int place,budget,pts,goals,win,draw,lost,conceded;
- Team(std::string n, std::string s, Player* tab,int Tsize, int b):
- stadium(s), name(n),budget(b)
- {
- size = Tsize;
- conceded = 0;
- draw = 0;
- goals = 0;
- lost = 0;
- pts = 0;
- win = 0;
- for(int i=0;i<size;i++){
- team[i] = tab[i];
- }
- }
- void Eleven(){
- if(size == ELEVEN){
- for(int i = 0; i < ELEVEN; i++){
- eleven[i] = team[i];
- }
- }
- else
- {
- std::cout << " Wybierz jedenastke meczowa: " << std::endl;
- bool tab[size];
- for(int k = 0; k < size; k++){
- tab[k] = true;
- }
- for(int j = 1; j<ELEVEN;){
- for(int i = 0; i < size; i++)
- {
- if(tab[i]){
- std::string wybor;
- std::cout << team[i].firstName << " " << team[i].sureName << " (y/n) : ";
- std::cin >> wybor;
- if(wybor == "y")
- {
- eleven[j] = team[i];
- j++;
- std::cout << j << std::endl;
- tab[i] = false;
- }
- }
- }
- }
- }
- std::cout << " Wybrana jedynastka : ";
- for(int l = 0; l < ELEVEN; l++)
- {
- std::cout << eleven[l].sureName << ", ";
- }
- }
- /*int Match(Team Against){
- *
- int home, away;
- for(int i=0;i<11;i++){
- if(eleven[i].position == "F")
- }
- }*/
- void add(Player P)
- {
- team[size] = P;
- size++;
- }
- /*
- fstream plik;
- plik.open("druzyna.csv",ios::in);
- if( plik.good() )
- {
- std::cout << "Plik został otwarty" << std::endl;
- int x = 1;
- int k = 0;
- for (int i = 0; plik.eof()!=1; i++)
- Druzyna[i] = new Player;
- if(x==1){
- getline(plik,Druzyna[i].,';');
- x++;
- }
- else{
- if(x==2){
- getline(plik,baza[k].nazwisko,';');
- x++;
- }
- else{
- if(x==3){
- getline(plik,baza[k].data,';');
- x++;
- }
- else{
- if(x==4){
- getline(plik,baza[k].mail,';');
- x++;
- }
- else{
- if(x==5){
- getline(plik,baza[k].wzrost,';');
- x++;
- }
- else{
- if(x==6){
- getline(plik,baza[k].telefon1,';');
- x++;
- }
- else{
- if(x==7){
- getline(plik,baza[k].telefon2,';');
- x++;
- }
- else{
- if(x==8){
- getline(plik,baza[k].telefon3,';');
- x++;
- }
- else{
- if(x==9){
- getline(plik,baza[k].plec);
- x = 1;
- k++;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- plik.close();
- }
- else
- { std::cout << "Nie udało się otworzyć pliku" << std::endl;
- }
- }*/
- };
- /*class Midfielder: public Player, public Rating
- * {
- int assisting, vision;
- };
- class Goalkeeper: public Player{
- int goalkeeping, reaction;
- };
- class Defender: public Player{
- int defending, interception;
- };
- class Forward: public Player{
- int shooting, dribble;
- };*/
- class Stats{};
- class Match:public Team
- {
- int home,away;
- Team team1,team2;
- };
- int main()
- {
- std::string wybor;
- while(wybor!="0"){
- std::cin >> wybor;
- Player p1("Mesut","Ozil","M",26,39,0,0);
- Player p2("Alexis","Sanchez","M",25,35,0,0);
- Player p3("Aaron","Ramsey","M",24,25,0,0);
- Player p4("Olivier","Giroud","F",26,20,0,0);
- Player p5("Santi","Cazorla","M",29,22,0,0);
- Player p6("Francis","Coquelin","M",23,11,0,0);
- Player p7("Gabriel","Paulista","D",24,11,0,0);
- Player p8("Laurent","Koscielny","D",27,18,0,0);
- Player p9("Nacho","Monreal","D",28,13,0,0);
- Player p10("Hector","Bellerin","D",20,5,0,0);
- Player p11("David","Ospina","G",29,8,0,0);
- Player tab[11]=
- {
- p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11
- } ;
- Team Arsenal("Arsenal","Emirates",tab,11,100);
- Player p12("Jack","Wilshere","M",24,22,0,0);
- Player p13("Theo","Walcott","M",26,22,0,0);
- Player p14("Alex","Oxlade-Chamberlain","M",21,17,0,0);
- Player p15("Mikel","Arteta","M",30,7,0,0);
- Arsenal.add(p12);
- Arsenal.add(p13);
- Arsenal.add(p14);
- Arsenal.add(p15);
- std::cout << Arsenal.size << std::endl;
- std::cout << Arsenal.team[13].sureName << std::endl;
- Arsenal.Eleven();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement