Guest User

Untitled

a guest
May 22nd, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.09 KB | None | 0 0
  1. #include <iostream>
  2. #include <dos.h>
  3. #include <stdio.h>
  4. #include "Player.h"
  5.  
  6. class Team
  7. {
  8. public:
  9.     Team(int teamNum);
  10.     ~Team();
  11.     int PlayQuarter();
  12.     void TeamName();
  13.     void PrintTeamStats();
  14.  
  15. private:
  16.     char teamName[20];
  17.     int currentTeam;
  18.     Player * player[5];
  19.     int teamScore;
  20.  
  21. };
  22.  
  23.  
  24.  
  25.  
  26.  
  27. Team::Team(int teamNum)
  28. {
  29. int i;
  30.  
  31. teamScore = 0;
  32. currentTeam = teamNum;
  33.  
  34. text_colour(f_gray, b_black);
  35. cout<<endl;
  36. cout<<"Team "<<teamNum+1<<" name? "<<endl;
  37. text_colour(f_white, b_black);
  38. cin.getline(teamName, 20, '\n');
  39. cout<<endl;
  40.  
  41.  
  42.  
  43.  
  44. for(i=0; i<5; i++)
  45.     player[i] = new Player(i);
  46.  
  47. }
  48.  
  49.  
  50.  
  51.  
  52. Team::~Team()
  53. {
  54.  
  55. }
  56.  
  57.  
  58.  
  59.  
  60.  
  61. int Team::PlayQuarter()
  62. {
  63. int currentPlayer = rand()%5;
  64.  
  65. int shit;
  66.  
  67. shit = player[currentPlayer]->TakeShot();
  68.  
  69. cout<<"The returned value is "<<shit<<endl;
  70.  
  71. //teamScore += player[currentPlayer]->TakeShot();
  72.  
  73. teamScore += shit;
  74.  
  75. return teamScore;
  76. }
  77.  
  78.  
  79.  
  80.  
  81.  
  82. void Team::TeamName()
  83. {
  84.  
  85. cout<<teamName;
  86. }
  87.  
  88.  
  89.  
  90.  
  91. void Team::PrintTeamStats()
  92. {
  93. cout<<"Team "<<teamName<<"'s stats "<<endl;
  94. for (int i=0; i<5; i++)
  95.     player[i]->Printout();
  96. }
Add Comment
Please, Sign In to add comment