sdata “antian”dengan Array

#include <iostream>
#include <conio.h>

using namespace std;

class Queue
{
private:
struct node
{
int data;

node *next;
};

node *belakang;
node *antrian;
node *depan;

public:
Queue();

int hapus();
int insert();

};

Queue::Queue()
{
belakang=0;
depan=0;
}

int Queue::insert()
{
int k;
cout<<“Masukkan angka dalam Queue : ” <<endl;
cin>>k;

antrian=new node;
if (belakang==0)
{
antrian->data=k;
antrian->next=0;
belakang=antrian;
depan=belakang;
}
else
{
antrian->data=k;
antrian->next=0;
belakang->next=antrian;
belakang=antrian;
}
system(“PAUSE”);
return EXIT_SUCCESS;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s