.hi guys..
.we meet again.. hahhahaha..
.sok yes w..
.now i just wanna post my code of linkedlist here..
.so if i have mistakes.. pease any body help me..
#include "iostream"
#include "Hmm.h"
void LinkedList::add(std::string x)
{
node *a;
a = b;
b = new node;
b->lagu = x;
b->link = a;
display ();
}
void LinkedList::del(std::string x)
{
node *a, *c;
a = b;
if (a->lagu == x)
{
b = a->link;
delete a;
return 0;
}
c = a;
while (a != NULL)
{
if (a->lagu == x)
{
c->link = a->link;
delete a;
return 0;
}
c = a;
a = a->link;
}
}
void LinkedList::display()
{
node *a;
a = b;
if (a == NULL)
{
return 0;
}
while (q != NULL)
{
cout << a->lagu;
a = a->link;
}
}
LinkedList::~LinkedList()
{
node *a;
if(b == NULL)
{
return 0;
}
while(b != NULL)
{
a = b->link;
delete b;
b = a;
}
}
.that's the code of linkedlist Hmm.cpp.. i dont know again.. what the name is suitable with that.. i'm so confused when named it.. hahhaha..
.and this is the header Hmm.h..
#include "iostream"
using namespace std;
class LinkedList
{
private :
string lagu;
node *link;
public :
void add (string);
void del (string);
void display ();
~LinkedList ();
.and for every body.. if u can make the code of Linkedlist in Linkedlist.. please help me... i need ur help.. T^T
.please..
.Okok.. just it.. i will wait u to help me guys.. ^^
Wednesday, June 9, 2010
Powered by Blogger.
0 komentar:
Post a Comment