Kamis, 16 Juni 2011

Program Single Linked List

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

#define Nil NULL
#define info(P) P->info
#define next(P) P->next
#define First(L) (L)

typedef int InfoType;
typedef struct telmlist *address;
typedef struct telmlist
{
InfoType info;
   address next;
}elmtlist;

typedef address list;

void CiptaSenarai(list *L)
{
First(*L) = Nil;
}

list NodBaru(int m)
{
list n;
   n = (list) malloc(sizeof(elmtlist));
   if (n !=NULL)
   {
    info(n) = m;
      next(n) = Nil;
   }

   return n;
}

void SisipSenarai (list *L, list t, list p)
{
if (p == Nil)
   {
    t->next = *L;
      *L = t;
   }
   else
   {
    t->next = p->next;
      p->next = t;
   }
}

void CetakSenarai (list L)
{
list ps;
   for (ps=L; ps!=Nil; ps=ps->next)
   {
    cout<<" "<<info(ps)<<" -->";
   }
   cout<<" NULL"<<endl;
}

int main()
{
list pel;
   list n;
   int i,k,nilai;

   CiptaSenarai(&pel);
   cout<<"Masukkan Banyak Data = ";
   cin>>k;
   for (i=1; i<=k; i++)
   {
    cout<<"Masukkan Data Senarai ke-"<<i<<" = ";
      cin>>nilai;
      n = NodBaru(nilai);
      SisipSenarai (&pel, n, NULL);
   }

   CetakSenarai(pel);
   getch();
   return 0;
}

Hasilnya inputkan data sendiri ya....!! hohaheh

Rabu, 15 Juni 2011

Program Single Linked List Nilai Terbesar & Terkecil

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

#define Nil NULL
#define info(P) P->info
#define next(P) P->next
#define First(L) (L)

typedef int InfoType;
typedef struct telmlist *address;
typedef struct telmlist
{
InfoType info;
   address next;
}elmtlist;

typedef address list;

void CiptaSenarai(list *L)
{
First(*L) = Nil;
}

list NodBaru(int m)
{
list n;
   n = (list) malloc(sizeof(elmtlist));
   if (n !=NULL)
   {
    info(n) = m;
      next(n) = Nil;
   }

   return n;
}

void SisipSenarai (list *L, list t, list p)
{
if (p == Nil)
   {
    t->next = *L;
      *L = t;
   }
   else
   {
    t->next = p->next;
      p->next = t;
   }
}

void CetakSenarai (list L)
{
list ps;
   for (ps=L; ps!=Nil; ps=ps->next)
   {
    cout<<" "<<info(ps)<<" -->";
   }
   cout<<" NULL"<<endl;
}

InfoType Max(list L)
{
address Pmax,Pt;

   Pmax = First(L);

   if (next(Pmax) == Nil)
   {
    return (info(Pmax));
   }
   else
   {
    Pt = next(Pmax);
      while (Pt != Nil)
      {
      if (info(Pmax) < info(Pt))
         {
          Pmax = Pt;
         }
         else
         {
          Pt = next(Pt);
         }
      }

      return (info(Pmax));
   }
}

InfoType Min(list L)
{
address Pmin,Pt;

   Pmin = First(L);

   if (next(Pmin) == Nil)
   {
    return (info(Pmin));
   }
   else
   {
    Pt = next(Pmin);
      while (Pt != Nil)
      {
      if (info(Pmin) > info(Pt))
         {
          Pmin = Pt;
         }
         else
         {
          Pt = next(Pt);
         }
      }

      return (info(Pmin));
   }
}

void main()
{
list pel;
   list n;
   int i,k,nilai,maks,min;

   CiptaSenarai(&pel);
   cout<<"Masukkan Banyak Data = ";
   cin>>k;
   for (i=1; i<=k; i++)
   {
    cout<<"Masukkan Data Senarai ke-"<<i<<" = ";
      cin>>nilai;
      n = NodBaru(nilai);
      SisipSenarai (&pel, n, NULL);
   }

   cout<<endl;
   CetakSenarai(pel);
   maks = Max(pel);
   min = Min(pel);

   cout<<endl;
   cout<<"Nilai terbesar : "<<maks;
   cout<<endl;
   cout<<"Nilai Terkecil : "<<min;
   getch();
}

Hasilnya inputkan data sendiri ya???? hhehee

Senin, 13 Juni 2011




Cewek Komersil

Yen metunangan ajak iluh ..
Ngae beli dadi frustasi..
Nagih kene lan nagih keto..
Ngae dompet beline puyung..

Sebilang pesu ngajak iluh..
Mirib beli kal bunuh diri..
Yening iluh nagih melali..
Beli harus ngabe mobil..

Dije beli ngalih pang nyidang ngabe mobil...
Dije beli nyilih mobil kelas tinggi..

Uli pidan beli sube nawang... iluh cewek Komersil..
Matan iluh tuwah dimobil... iluh cewek Matre....2x

Duang bulan iluh sing ade kabar..
Jani irage buin ketemu..
Minab irage mule jodoh..
Beli buin nepukin iluh..

Iluh maekin beli... beli sok jual mahal..
Beli sing nganggoang iluh... Karne...

Uli pidan beli sube nawang... iluh cewek Komersil..
Matan iluh tuah dimobil.. iluh cewek Matre.....2x

Jumat, 10 Juni 2011

My name is KEJU

Childhood before I named my first KEJU invoked ADE. I likes to play the kite so that my skin burnt by the sun and colored black. Before named KEJU I was called JUWET (name of fruit), namely that black JUWET who first called by my uncle and for some reason I am for my friends called me with the title JUWET. In elementary school my class had been called JUWET but over time the name was changed to KEJU because all my friends call me JU, JU, JU, and eventually turned into KEJU. after I was in junior high school I never hope to change the nickname again to ADE but the effort was in vain because my friends already know my name as the KEJU. Finally fixed KEJU nickname I use to this day. I am proud to have a nickname by the name of the KEJU because I could have lots of friends.

That's why I brief my story can be named KEJU.
why I make this story because to answer the question that many friends who ask why my name could KEJU