SHARE
TWEET

Untitled

a guest Feb 17th, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include "Group.h"
  4.  
  5. // Add your code here.
  6.  
  7. Group::Group(int id, string name)
  8. {
  9.     _id = id;
  10.     _name = name;
  11. }
  12.  
  13.  
  14.  
  15. int Group::getId()
  16. {
  17.     return _id;
  18. }
  19.  
  20. string Group::getName()
  21. {
  22.     return _name;
  23. }
  24.  
  25. void Group::addMember(Person *p)
  26. {
  27.     members.push_back(p); // add pointer p to end of vector
  28. }
  29.  
  30. void Group::delMember(string name)
  31. {
  32.     // search in vector Person* members  for p->getName() to match string name
  33.     vector<Person*>::iterator myIter;
  34.    
  35.     for (myIter = members.begin(); myIter != members.end(); ++myIter)
  36.     {
  37.         // get the location of matched name
  38.         if ( (*myIter)->getName() == name) {break; }
  39.     }
  40.    
  41.     members.erase(myIter);
  42.     myIter = members.begin(); // reset myIter
  43.    
  44. }
  45.  
  46. int Group::getNumOfMembers()
  47. {
  48.     return members.size();
  49.     // return no of member in the object
  50. }
  51.  
  52. Person* Group::getMember(int i)
  53. {
  54.     Person* pptr; // EDIT CODE HERE
  55.     return pptr;
  56. }
  57.  
  58. Person* Group::getSocialCapital()
  59. {
  60.     Person* pptr; // EDIT CODE HERE
  61.     return pptr;
  62. }
RAW Paste Data
Top