Radu-Adrian Marcu / Mbed OS SOFT253_GroupA_AssignmentRepo

Dependencies:   LPS25H hts221

Fork of SOFT253_Template_Weather_OS_54 by Stage-1 Students SoCEM

Revision:
43:3983059e0d91
Parent:
42:b1f29874ab70
Child:
44:b523c9a9dd97
diff -r b1f29874ab70 -r 3983059e0d91 LinkedList.cpp
--- a/LinkedList.cpp	Wed Apr 05 16:12:42 2017 +0000
+++ b/LinkedList.cpp	Thu Apr 06 10:48:12 2017 +0000
@@ -55,9 +55,45 @@
     void LinkedList::ListAll()
     {
         Node *n = head;
+        int i = 0;
         while(n->next != NULL)
         {
-            printf("T: %f | H: %f | P: %f |\r\n",n->measure.temperature, n->measure.humidity, n->measure.pressure);
+            i++;
+            printf("%i. T: %f | H: %f | P: %f |\r\n",i ,n->measure.temperature, n->measure.humidity, n->measure.pressure);
             n = n->next;   
         }   
+    }
+    void LinkedList::ListX(int x)
+    {
+        Node *n = head;
+        int i = 0;
+        while(n->next != NULL && i < x)
+        {
+            printf("%i. T: %f | H: %f | P: %f |\r\n",i , n->measure.temperature, n->measure.humidity, n->measure.pressure);   
+            i++;
+            n = n->next; 
+        }   
+    }
+    void LinkedList::DeleteAll()
+    {
+        while(head->next != NULL)
+        {
+               Node *n = head;
+               head = head -> next;
+               
+               delete n;
+               
+               size = 0;
+        }   
+    }
+    void LinkedList::DeleteX(int x)
+    {
+        int i = 0;
+        while(head->next != NULL && i < x)
+        {
+            Node *n = head;
+            head = head->next;
+            delete n;
+        }   
+        size -= x;
     }
\ No newline at end of file