Diberdayakan oleh Blogger.
"DbClix"BismaClix.com - Inovasi Baru PTC Indonesia"Zonaclix - A Place to Earn online!"DbClix"Zonaclix - A Place to Earn online!"BismaClix.com - Inovasi Baru PTC Indonesia"Bux7"" ""SentraClix" lind4clix"Smileclix - PTC Indonesia dengan support profesional!
Tampilkan postingan dengan label Algoritma. Tampilkan semua postingan
Tampilkan postingan dengan label Algoritma. Tampilkan semua postingan

Selasa, 07 Juni 2011

linked list

menghapus

#include<iostream>
using namespace std;
void main(){
    struct node
    {
        int data;     //will store information
        node*next;    //the reference to the next node

    };
    node*head=NULL;    //create head
    node*newNode;      //create a temporary node
    int nilai=10;
    char ulang;

    //add@front
    newNode=(node*)malloc(sizeof(node));//allocate space for node
    newNode->data=nilai;
    newNode->next=head;
    head=newNode;
    do {
    //add@front
    newNode=(node*)malloc(sizeof(node));//allocate space for node
    newNode->data=nilai;
    newNode->next=head;
    head=newNode;
    //cetak isi linked list
    cout<<"\n Isi List:";
    node*temp;
    temp=head;//transfer the address of 'temp' to 'head'
    while(temp!=NULL)
    {
        cout<<temp->data<<"\t";//show the data in the linked list
        temp=temp->next; //transfer the address if 'temp->next' to 'temp'
    }
    cout<<"\nulang lagi(y/t:";cin>>ulang;
    nilai++;
    }
    while(ulang=='y');

    //delete@front hapus simpul paling depan
    node*temp;
    temp=(node*)malloc(sizeof(node));//allocate space for node
    temp->data=nilai;
    temp->next=head;
    head=newNode;
    free(temp);
    //cetak list setelah delete@front
    temp=head;//transfer the address of'temp' to 'head'
    cout<<"\nIsi List Baru:";
    while(temp!=NULL)
    {
        cout<<temp->data<<"\t";//show the data in the linked list
        temp=temp->next; //transfer the address if 'temp->next' to 'temp'
    }
cout<<endl;

    system("pause");
}

linked list

mengulangi data

#include<iostream>
using namespace std;
void main(){
    struct node
    {
        int data;     //will store information
        node*next;    //the reference to the next node

    };
    node*head=NULL;    //create head
    node*newNode;      //create a temporary node
    int nilai=10;
    char ulang;

    //add@front
    newNode=(node*)malloc(sizeof(node));//allocate space for node
    newNode->data=nilai;
    newNode->next=head;
    head=newNode;
    do {
    //add@front
    newNode=(node*)malloc(sizeof(node));//allocate space for node
    newNode->data=nilai;
    newNode->next=head;
    head=newNode;

    //cetak isi linked list
    cout<<"\n Isi List:";
    node*temp;
    temp=head;//transfer the address of 'temp' to 'head'
    while(temp!=NULL)
    {
        cout<<temp->data<<"\t";//show the data in the linked list
        temp=temp->next; //transfer the address if 'temp->next' to 'temp'
    }
    cout<<"\nulang lagi(y/t:";cin>>ulang;
    nilai++;
    }
    while(ulang=='y');

    system("pause");
}

linked list

mengeluarkan data(nilai)

#include<iostream>

using namespace std;
void main(){
    struct node
    {
        int data;     //will store information
        node*next;    //the reference to the next node

    };
    node*head=NULL;    //create head
    node*newNode;      //create a temporary node
    int nilai=10;
    //add@front
    newNode=(node*)malloc(sizeof(node));//allocate space for node
    newNode->data=nilai;
    newNode->next=head;
    head=newNode;

    nilai=50;
    //add@front
    newNode=(node*)malloc(sizeof(node));//allocate space for node
    newNode->data=nilai;
    newNode->next=head;
    head=newNode;

    //cetak isi linked list
    node*temp;
    temp=head;//transfer the address of 'temp' to 'head'
    while(temp!=NULL)
    {
        cout<<temp->data<<"\t";//show the data in the linked list
        temp=temp->next; //transfer the address if 'temp->next' to 'temp'
    }
    system("pause");
}

linked list

linked list
tidak ada data


#include<iostream>
#include<conio.h>
using namespace std;
void main(){
    struct node
    {
        int data;     //will store information
        node*next;    //the reference to the next node

    };
    node*head=NULL;    //create head
    node*newNode;      //create a temporary node
    int nilai=10;
    //add@front
    newNode=(node*)malloc(sizeof(node));//allocate space for node
    newNode->data=nilai;
    newNode->next=head;
    head=newNode;
    _getch();
}

Minggu, 29 Mei 2011

Program

//BUATLAH SEBUAH PROGRAM UNTUK MEMBENTUK POHON PENCARIAN BINER
//UNTUK DATA SEPERTI BERIKUT={F,S,D,E,T}
GUNAKAN STRUKTUR & PIONTER!!!!!!!!!!

#include"iostream"
using namespace std;
void main(){
    /*
    int nilai=50;
    int*pnilai;//deklarasi pointer
    cout<<"alamat memori variabel nilai:"<<&nilai<<endl;
    cout<<"isi memori variabel nilai"<<nilai<<endl;
    pnilai=&nilai;
    cout<<"pointer pnilai berisi alamat nilai:"<<pnilai;
    cout<<*pnilai;
    *pnilai=100;
    cout<<"isi nilai sekarang:"<<nilai;
    */
    char data[]={'F','S','D','E','T'};
    char*pdata;
    cout<<"pilih simpul:"<<data<<endl;//cetak &data[0]
    cout<<*data;
    cout<<*data<<endl;
   
   
    system("pause");
}

Program

#include"iostream"
using namespace std;
void main(){
    /*
    int nilai=50;
    int*pnilai;//deklarasi pointer
    cout<<"alamat memori variabel nilai:"<<&nilai<<endl;
    cout<<"isi memori variabel nilai"<<nilai<<endl;
    pnilai=&nilai;
    cout<<"pointer pnilai berisi alamat nilai:"<<pnilai;
    cout<<*pnilai;
    *pnilai=100;
    cout<<"isi nilai sekarang:"<<nilai;
    */
    char data[4]={50,60,30,10};
    char*pdata;
    cout<<"alamat awal array:"<<data<<endl;//cetak &data[0]
    cout<<*data;
    cout<<*data+3<<endl;
    pdata=data;
    for(int i=0;i<3;i++)
        cout<<*pdata++;
    system("pause");
}

Program

mencari letak memori

#include"iostream"
using namespace std;
void main(){
    /*
    int nilai=50;
    int*pnilai;//deklarasi pointer
    cout<<"alamat memori variabel nilai:"<<&nilai<<endl;
    cout<<"isi memori variabel nilai"<<nilai<<endl;
    pnilai=&nilai;
    cout<<"pointer pnilai berisi alamat nilai:"<<pnilai;
    cout<<*pnilai;
    *pnilai=100;
    cout<<"isi nilai sekarang:"<<nilai;
    */
    char data[4]={50,60,30,10};
    char*pdata;
    cout<<"alamat awal array:"<<data<<endl;//cetak &data[0]
    cout<<*data;
    cout<<*data+3<<endl;
    system("pause");
}

Program

#include"iostream"
using namespace std;
void main(){
    /*
    int nilai=50;
    int*pnilai;//deklarasi pointer
    cout<<"alamat memori variabel nilai:"<<&nilai<<endl;
    cout<<"isi memori variabel nilai"<<nilai<<endl;
    pnilai=&nilai;
    cout<<"pointer pnilai berisi alamat nilai:"<<pnilai;
    cout<<*pnilai;
    *pnilai=100;
    cout<<"isi nilai sekarang:"<<nilai;
    */
    char data[4];
    char*pdata;
    cout<<data;
    system("pause");
}

Program

#include"iostream"
using namespace std;
void main(){
    int i=50;
    int j=75;
    int*p1;int*p2;//deklarasi pointer
    p1=&i;p2=&j;
    cout<<*p1;
    p2=p1;*p2=0;
   
    cout<<*p1;
    system("pause");
}

Program

#include"iostream"
using namespace std;
void main(){
    int nilai=50;
    int*pnilai;//deklarasi pointer
    cout<<"alamat memori variabel nilai:"<<&nilai<<endl;
    cout<<"isi memori variabel nilai"<<nilai<<endl;
    pnilai=&nilai;
    cout<<"pointer pnilai berisi alamat nilai:"<<pnilai;
    cout<<*pnilai;
    *pnilai=100;
    cout<<"isi nilai sekarang:"<<nilai;
    system("pause");
}

Program

#include"iostream"
using namespace std;
void main(){
    int nilai=50;
    int*pnilai;//deklarasi pointer
    cout<<"alamat memori variabel nilai:"<<&nilai<<endl;
    cout<<"isi memori variabel nilai"<<nilai<<endl;
    pnilai=&nilai;
    cout<<"pointer pnilai berisi alamat nilai:"<<pnilai;
    cout<<*pnilai;
    system("pause");
}

Program

#include"iostream"
using namespace std;
void main(){
    int nilai=50;
    int*pnilai;//deklarasi pointer
    cout<<"alamat memori variabel nilai:"<<&nilai<<endl;
    cout<<"isi memori variabel nilai"<<nilai<<endl;
    pnilai=&nilai;
    cout<<"pointer pnilai berisi alamat nilai:"<<pnilai;
    system("pause");
}

Sabtu, 28 Mei 2011

Program

#include"iostream"
using namespace std;
void main(){
    int nilai=50;
    int*pnilai;//deklarasi pointer
    cout<<&nilai<<endl;
    cout<<nilai<<endl;
    system("pause");
}
free web site traffic and promotion
Get Free Music at www.divine-music.info
Get Free Music at www.divine-music.info

Free Music at divine-music.info
DbClix BismaClix.com - Inovasi Baru PTC Indonesia Zonaclix - A Place to Earn online! DbClix Zonaclix - A Place to Earn online! BismaClix.com - Inovasi Baru PTC Indonesia Bux7 " SentraClix lind4clix EksisPTC Smileclix - PTC Indonesia dengan support profesional!
 

Copyright © 2009 by Bisnis Online

Template by Blogger Templates | Powered by Blogger