Computer Classes
Hello Friends,
Those have 4+ year of exp in angular,follow following link.
Thanks,
Linked List using CPP (Object oriented concepts):
using namespace std;
class Node
{
int data;
Node *next;
public:
Node(int inData)
{
data = inData;
next = NULL;
}
Node * getNext()
{
return next;
}
void setNext(Node *inNode)
{
next = inNode;
}
int getData()
{
return data;
}
};
class LinkedList
{
Node *start;
public:
LinkedList()
{
start = NULL;
}
void insert(int inData)
{
Node *newNode = new Node(inData);
if ( start == NULL )
{
start = newNode;
}
else
{
Node *temp = start;
while (temp->getNext())
{
temp = temp -> getNext();
}
temp->setNext(newNode);
}
}
void display()
{
Node *temp = start;
while (temp )
{
int d = temp->getData();
printf("%d -> ",temp->getData());
cout getNext();
}
}
};
int main(int argc, const char * argv[])
{
LinkedList *ll= new LinkedList();
ll->insert(10);
ll->insert(20);
ll->insert(30);
ll->insert(40);
ll->display();
return 0;
}
Click here to claim your Sponsored Listing.
Category
Contact the school
Telephone
Website
Address
Akurdi Railway Station
Pune
411035