TUGAS MODUL 6.1 LINKED LIST
input :
// Name : 1_LinkedList.cpp
// Author : agust
// Version :
// Copyright :
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
//#include <conio.h>
#include <malloc.h>
using namespace std;
int main()
{
int i;
struct ListEntry
{
int number;
struct ListEntry *next;
} start, *node;
start.next=NULL;
node=&start;
for (i=1; i<=10; i++)
{
node->next=(struct ListEntry *) malloc(sizeof(struct ListEntry));
node=node->next;
node->number=i;
node->next=NULL;
}
node=start.next;
while (node)
{
cout<<node->number;
node=node->next;
}
return 0;
}
output :


Tidak ada komentar:
Posting Komentar