Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SOFT253_Template_Weather_OS_54 by
LinkedList.cpp
- Committer:
- FairyMental
- Date:
- 2017-04-05
- Revision:
- 40:ba083993b481
- Child:
- 42:b1f29874ab70
File content as of revision 40:ba083993b481:
#include "LinkedList.h"
#include <stdio.h>
#include <ctype.h>
// constructor
LinkedList::LinkedList()
{
head = NULL;
}
void LinkedList::addValueFront(Measure _measure){
Node *n = new Node();
n->measure = _measure;
n->next = head;
head = n;
}
void LinkedList::addValueEnd(Measure _measure)
{
if(head == NULL)
{
Node *aux = new Node();
aux->measure = _measure;
aux->next = NULL;
head = aux;
}
else
{
Node *n = head;
while(n->next != NULL)
{
n = n->next;
}
Node *aux = new Node();
aux->measure = _measure;
aux->next = NULL;
n->next = aux;
}
}
Measure LinkedList::popValueFRONT()
{
Node *n = head;
Measure _measure = n->measure;
head = head->next;
delete n;
return _measure;
}
