League.cpp


SUBMITTED BY: Guest

DATE: Sept. 5, 2014, 9:06 p.m.

FORMAT: C++

SIZE: 889 Bytes

HITS: 618

  1. #include <iostream>
  2. #include "sleague.h"
  3. using namespace std;
  4. Team::Team(char n[], int s, int f)
  5. {
  6. name = n;
  7. skill = s;
  8. form = f;
  9. }
  10. Team::Team()
  11. {
  12. name="";
  13. skill=0;
  14. form=0;
  15. }
  16. int Team::setskill(int s){
  17. int oldskill=skill;
  18. skill = s;
  19. return oldskill;
  20. }
  21. int Team::setform(int f){
  22. int oldform=form;
  23. form = f;
  24. return oldform;
  25. }
  26. League::League()
  27. {
  28. teamcnt=0;
  29. }
  30. int League::leagueteams()
  31. {
  32. return teamcnt;
  33. }
  34. int League::addteam(Team &n)
  35. {
  36. teams = new Team[teamcnt];
  37. *teams = n;
  38. teams++;
  39. teamcnt++;
  40. return teamcnt;
  41. }
  42. void League::printteams()
  43. {
  44. for(int i=0;i<teamcnt;i++){
  45. cout<<teams->name<<endl;
  46. teams++;
  47. }
  48. }