#include <cstdlib>
#include <iostream>
using namespace std;
struct link{
int nilai;
link *next;
};
link *head=NULL;
void insert(int i){
link *temp =new link;
temp->nilai=i;
temp->next=NULL;
if(head==NULL){
head=temp;
}
else{
link *temp2= head;
while(temp2->next !=NULL){
temp2=temp2->next;
}
temp2->next=temp;
}
}
void cetak(){
link *baik =head;
while(baik !=NULL){
cout<<baik->nilai<<" ";
baik=baik->next;
}
}
int main(int argc, char *argv[])
{
insert(3);
insert(7);
insert(90);
insert(6);
insert(5);
cetak();
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Rabu, 05 Oktober 2016
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar