#include <conio>
#include <iostream>
#include <list>
#include <malloc>
#include <stdio>
typedef struct nod
{
int data;
struct nod *next;
} NOD, *NODPTR;
void BuatList (NODPTR *s)
{
*s =NULL;
}
NODPTR NodBaru (int m)
{
NODPTR n;
n= (NODPTR) malloc(sizeof (NOD));
if (n != NULL)
{
n->data = m;
n-> next = NULL;
}
return n;
}
void SisipList (NODPTR *s, NODPTR t, NODPTR p)
{
if (p==NULL)
{
t-> next = *s;
*s = t;
}
else
{
t->next = p -> next;
p->next = t;
}
}
void CetakList (NODPTR s)
{
NODPTR ps;
for(ps=s;ps!=NULL;ps=ps->next)
printf("%d -->", ps -> data);
printf("NULL\n");
}
int main()
{
NODPTR pel;
NODPTR n;
BuatList (&pel);
n = NodBaru(i);
SisipList (&pel, n, NULL);
n=NodBaru(75);
SisipList (&pel, n, NULL);
n=NodBaru(77);
SisipList (&pel, n, NULL);
CetakList(pel);
getch();
}
Subscribe to:
Post Comments (Atom)
CONTOH CODING LINKED LIST MENGGUNAKAN BORLAND C++
CONTOH CODING LINKED LIST MENGGUNAKAN BORLAND C++ #include<stdlib.h> #include<conio.h> #include<iostream.h> struc...
-
#include <iostream.h> #include <conio.h> #include <fstream.h> #include <stdio.h> #include <stdlib.h> struct pa...
-
#include <iostream.h> #include <conio.h> #include <fstream.h> #include <stdio.h> #include <iomanip.h> #include...
-
#include <iostream.h> #include <iomanip.h> #include <stdio.h> #include <conio.h> void coba(); struct rumahsakit { ...
No comments:
Post a Comment