Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. void SimpleReg::removeTeam(string name){
  2.  
  3.     Team *tempList;
  4.  
  5.     if (teamNo == 0) {
  6.         cout << "Warning! There is no team " << endl;
  7.         return;
  8.     } else if (teamNo == 1){
  9.         delete[]teams;
  10.         teams = NULL;
  11.         teamNo = 0;
  12.         return;
  13.     } else { // more than 1
  14.         if (findTeam(name) == -1){
  15.  
  16.         cout << "warning! there is no team with the given name " << name << endl;
  17.         }
  18.         else{
  19.  
  20.             int count = 0;
  21.             tempList = teams;
  22.             teamNo--;
  23.             teams = new Team[teamNo];
  24.  
  25.             for(int i = 0; i < teamNo+1;i++){
  26.                     //compare the names and delete the given name team
  27.                 if(!compareTeamNames(tempList[i].getTeamName(), name)){
  28.                     teams[count] = tempList[i];
  29.                     count++;
  30.                 }
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement