Advertisement
Guest User

Untitled

a guest
Oct 5th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1.  
  2. struct node
  3. {
  4.     Vector *controlPoint;
  5.     float time;
  6.     node *next;
  7. };
  8.  
  9. node *firstPoint;
  10. node *secondPoint;
  11. node *focusPoint;
  12.  
  13. node* addPoint(Vector *point, float time)
  14. {
  15.     node *temp;
  16.     temp = new node;
  17.     temp->controlPoint = point;
  18.     temp->time = time;
  19.     if (firstPoint == NULL)
  20.     {
  21.         firstPoint = temp;
  22.         firstPoint->next = NULL;
  23.     }
  24.     else
  25.     {
  26.         node *it = firstPoint;
  27.         while (it->next != NULL) {
  28.             it = it->next;
  29.         }
  30.         it->next = temp;
  31.         temp->next = NULL;
  32.     }
  33.     return temp;
  34. }
  35.  
  36. int countPoints() {
  37.     int count = 0;
  38.     if (firstPoint != NULL) {
  39.         ++count;
  40.         node* it = firstPoint;
  41.         while (it->next != NULL) {
  42.             it = it->next;
  43.             ++count;
  44.         }
  45.     }
  46.     return count;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement