CaptainSpaceCat

PointList.h

Apr 2nd, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. class PointList {
  2.  
  3.   public:
  4.     int len;
  5.     int list[16][2];
  6.    
  7.     PointList() {
  8.       len = 0;
  9.     }
  10.  
  11.     void add(int point[]) {
  12.       list[len][0] = point[0];
  13.       list[len][1] = point[1];
  14.       len++;
  15.     }
  16.  
  17.     void rem(int index) {
  18.       for (int i = index; i < len-1; i++) {
  19.         list[i][0] = list[i+1][0];
  20.         list[i][1] = list[i+1][1];
  21.       }
  22.       list[len-1][0] = 0;
  23.       list[len-1][1] = 0;
  24.       len--;
  25.     }
  26. };
Add Comment
Please, Sign In to add comment