Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct node
- {
- string data;
- struct node *next;
- };
- void tambahBelakang(node *simpul,string a)
- {
- node *baru;
- baru=new Node;
- baru->data=a;
- baru->next=simpul->next;
- simpul->next=baru;
- }
- void tambahDepan(node *simpul,string a)
- {
- node *baru,*depan;
- baru=new(node);
- baru->data=a;
- baru->next=NULL;
- depan=simpul->next;
- while(depan->next!=NULL)
- {
- depan=depan->next;
- }
- depan->next=baru;
- }
- void ambilBelakang(node *simpul)
- {
- simpul->next=simpul->next->next
- }
- void ambilDepan(node *simpul)
- {
- node *hapus;
- hapus=simpul->next;
- while(hapus->next->next!=NULL)
- {
- hapus=hapus->next;
- }
- hapus->next!=NULL;
- }
- void cetak (node *simpul)
- node *baca;
- baca=simpul->next;
- while(baca!=NULL)
- {
- cout<<"Nama ="<<baca->data<<endl:
- baca=baca->next;
- }
- int main()
- {
- node *baca;
- baca=simpul->next;
- while(baca!=NULL)
- {
- cout<<"Nama : "<<baca->data<<endl;
- baca=baca->next;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement