Blog Archive
- 2012 (1)
-
2011
(25)
- Agustus(2)
- Juli(4)
- Februari(1)
-
Januari(18)
- fantasi "gedung UIN syarif hidayatullah jakarta"
- Renungan motivasi mengenai " Waktu "
- Tentang Visi
- all about bicycle
- PENYESALAN
- OPTIMIS & PESIMIS ??
- BERSEMANGATLAH
- BUKTIKANLAH!!
- IMPIAN
- Tak Usah KHawatir
- Program silsilah keluarga c++
- Program antrian bank C++
- flowchart
- c++ kalkulator sederhana
- program SECANT
- program matriks
- c++ tutorial 2
- c++ tutorial
- 2010 (20)
About
buku yang sayabaca
Labels
- Iseng-iseng (2)
- kuliah semester 4 (1)
- motivasi (17)
- programming (8)
- story about social networking (9)
- unekunek (3)
Labels
- Iseng-iseng (2)
- kuliah semester 4 (1)
- motivasi (17)
- programming (8)
- story about social networking (9)
- unekunek (3)
Sponsors
Labels
- Iseng-iseng (2)
- kuliah semester 4 (1)
- motivasi (17)
- programming (8)
- story about social networking (9)
- unekunek (3)
Pages
TRANSLATE
Blogroll
video-entry
Banner 468 x 60px
BUKU TAMU
KIRIM SMZ GRATIS DI SINI
Your browser does not support frame.
Link List
Pages
Diberdayakan oleh Blogger.
Labels
- Iseng-iseng (2)
- kuliah semester 4 (1)
- motivasi (17)
- programming (8)
- story about social networking (9)
- unekunek (3)
Labels
- Iseng-iseng (2)
- kuliah semester 4 (1)
- motivasi (17)
- programming (8)
- story about social networking (9)
- unekunek (3)
Popular Posts
-
#include #include #include #include #include #include #include struct node { char name[20]; node *left; node *right; ...
-
di dalam permainan ini terdapat dadu yang siap dilemparkan dan qt tidak mengetahui nilai yg keluar berapa. setiap nilai yg keluar menandaka...
-
ada baiknya mari kita menyanyikan lagu " Indonesia Raya " terlebih dahulu Teks Lagu Indonesia tanah airku Tanah ...
-
Bila anda mencari alasan untuk sebuah kegagalan, anda bisa temukan berjuta-juta dengan mudahnya. Namun, alasan tetaplah alasan, la takkan me...
-
#include #include #include #define MAX 6 typedef struct{ int data[MAX]; int head; int tail; } Queue; Queue antrian; void Create(){ ...
-
Pengertian Flowchart adalah penggambaran secara grafik dari langkah-langkah dan urut-urutan prosedur dari suatu program. Flowchart menolong ...
-
Ebay adalah situs Jual-beli yang paling terkenal dan laku dipergunakan oleh masyarakat di dunia. Situs web pelelangan online ini ditemukan d...
-
Janganlah mengkhawatirkan hal-hal yang tidak dapat Anda kerjakan. Khawatirkanlah hal-hal yang sebetulnya dapat Anda kerjakan ...tapi yang ti...
About Me
About Me
Followers
Blog Archive
-
▼
2011
(25)
-
▼
Januari
(18)
- fantasi "gedung UIN syarif hidayatullah jakarta"
- Renungan motivasi mengenai " Waktu "
- Tentang Visi
- all about bicycle
- PENYESALAN
- OPTIMIS & PESIMIS ??
- BERSEMANGATLAH
- BUKTIKANLAH!!
- IMPIAN
- Tak Usah KHawatir
- Program silsilah keluarga c++
- Program antrian bank C++
- flowchart
- c++ kalkulator sederhana
- program SECANT
- program matriks
- c++ tutorial 2
- c++ tutorial
-
▼
Januari
(18)
Jumat, 07 Januari 2011
Program silsilah keluarga c++
#include
#include
#include
#include
#include
#include
#include
struct node
{
char name[20];
node *left;
node *right;
};
class family
{
public:
void addleft(node *);
void addright(node *);
void editleft(node *);
void editright(node *);
void delleft(node *);
void delright(node *);
void findleft(node *);
void findright(node *);
void searchleft(node *);
void searchright(node *);
};
//satu
void family::addleft(node *kaliwa)
{
cout<<"Masukkan nama: ";gets(kaliwa->name);
}
//dua
void family::findleft(node *hanapleft)
{
while(hanapleft!=NULL)
{
cout<name;
hanapleft=hanapleft->left;cout<<"\n";
}
}
//tiga
void family::addright(node *kanan)
{
cout<<"Masukkan nama: ";gets(kanan->name);
}
//empat
void family::findright(node *hanapright)
{
while(hanapright!=NULL)
{
cout<name;
hanapright=hanapright->right;cout<<"\n";
}
}
//lima
void family::searchleft(node *hanapinleft)
{
char findname[80];
cout<<"ketik sebuah nama : ";gets(findname);
while(hanapinleft!=NULL)
{if(strcmp(findname,hanapinleft->name)==0)
{cout<<"elemen yang dimasukkan sudah ada\n siahkan anda ketik lagi!";}
hanapinleft=hanapinleft->left;
}
}
//enam
void family::searchright(node *hanapinright)
{
char findname2[80];
cout<<"Ketik sebuah nama: ";gets(findname2);
while(hanapinright!=NULL)
{if(strcmp(findname2,hanapinright->name)==0)
{cout<<"Data yang anda ketik ada!";}
hanapinright=hanapinright->right;
}
}
//tujuh
void family::delleft(node *)
{
char delname[80];
cout<<"Type name: ";gets(delname);
}
//delapan
void family::delright(node *)
{
char delname2[80];
cout<<"Type name: ";gets(delname2);
}
//sembilan
void main()
{
clrscr();
family pamilya; //Object of Class
int option;
ofstream out_file; //cout sa Filestream
char file[80];
char familyname[80];
node *l1,*l2,*r1,*r2,master;
l1 =new node;
l2=l1;
r1=new node;
r2=r1;
char a,b;
out_file.open(file);
clrscr();
cout<<"Masukkan nama keluarga Anda: ";gets(familyname);
cout<<"\n\nThank You! Press Any Key to Continue";
getch();
clrscr();
int nX = 2, nY = 2; //pang scroll
int ch; //inequate sa getch()
do{
clrscr();
cout< cout<<"\n[1] Tambahkan elemen";
cout<<"\n[2] Edit Element";
cout<<"\n[3] Hapus Left Child (nama anak)";
cout<<"\n[4] Hapus Right Child(nama cucu)";
cout<<"\n[5] cari Left Child (nama anak)";
cout<<"\n[6] cari Right Child (nama cucu)";
cout<<"\n[7] Tampilkan nama anak";
cout<<"\n[8] Tampilkan nama cucu";
cout<<"\n[10] Exit";
cin>>option;
switch (option)
{
case 1: //Every element will be asked to input left and right childs, pero optional un kung ndi nya llagyan...
{
flagleft:
clrscr();
cout<<"Left Child (nama anak):\n";
pamilya.addleft(l2);
cout<<"Apakah Anda ingin menambah nama Left Child (anak)? [y/n]";
cin>>a;
if(a=='y')
{l2->left=new node;
l2=l2->left;
goto flagleft;}
l2->left=NULL;
getch();
}
{
flagright:
clrscr();
cout<<"nama cucu (Right Child):\n";
pamilya.addright(r2);
cout<<"Apakan Anda ingin menambah nama Right Child (cucu)? [y/n]";
cin>>b;
if(b=='y')
{r2->right=new node;
r2=r2->right;
goto flagright;}
r2->right=NULL;
getch();
break;
}
case 2: //String Compare, if yes, overwrite, if no matches, tatanungin ule
{
cout<<"Type new name: ";
getch();
break;
}
case 3: //String Compare na lang siguro ule...
{
pamilya.delleft(l1);
cout<<"Deleted!";
getch();
break;
}
case 4:
{
pamilya.delright(r1);
cout<<"Deleted!";
getch();
break;
}
case 5: //String Compare
{clrscr();
pamilya.searchleft(l1);
getch();
break;
}
case 6: //String Compare
{clrscr();
pamilya.searchright(r1);
getch();
break;
}
case 7: //Lahat ng Left
{
cout<<"\n\n\n\nberikut ini adalah element dari left childs (anak): \n";
pamilya.findleft(l1);
getch();
break;
}
case 8: //Lahat ng Right
{
cout<<"\n\n\n\nberikut ini adalah element dari right childs (cucu): \n";
pamilya.findright(r1);
getch();
break;
}
case 9: //Naka notepad?? Pano iddrawing ung branches??
{
getch();
break;
}
case 10:
{
cout<<"\n\nThank You!";
break;
}
default:
cout<<"\n\nAnda salah PILIH!";
getch();
break;
}
}while(option!=10);
getch();
}
#include
#include
#include
#include
#include
#include
struct node
{
char name[20];
node *left;
node *right;
};
class family
{
public:
void addleft(node *);
void addright(node *);
void editleft(node *);
void editright(node *);
void delleft(node *);
void delright(node *);
void findleft(node *);
void findright(node *);
void searchleft(node *);
void searchright(node *);
};
//satu
void family::addleft(node *kaliwa)
{
cout<<"Masukkan nama: ";gets(kaliwa->name);
}
//dua
void family::findleft(node *hanapleft)
{
while(hanapleft!=NULL)
{
cout<
hanapleft=hanapleft->left;cout<<"\n";
}
}
//tiga
void family::addright(node *kanan)
{
cout<<"Masukkan nama: ";gets(kanan->name);
}
//empat
void family::findright(node *hanapright)
{
while(hanapright!=NULL)
{
cout<
hanapright=hanapright->right;cout<<"\n";
}
}
//lima
void family::searchleft(node *hanapinleft)
{
char findname[80];
cout<<"ketik sebuah nama : ";gets(findname);
while(hanapinleft!=NULL)
{if(strcmp(findname,hanapinleft->name)==0)
{cout<<"elemen yang dimasukkan sudah ada\n siahkan anda ketik lagi!";}
hanapinleft=hanapinleft->left;
}
}
//enam
void family::searchright(node *hanapinright)
{
char findname2[80];
cout<<"Ketik sebuah nama: ";gets(findname2);
while(hanapinright!=NULL)
{if(strcmp(findname2,hanapinright->name)==0)
{cout<<"Data yang anda ketik ada!";}
hanapinright=hanapinright->right;
}
}
//tujuh
void family::delleft(node *)
{
char delname[80];
cout<<"Type name: ";gets(delname);
}
//delapan
void family::delright(node *)
{
char delname2[80];
cout<<"Type name: ";gets(delname2);
}
//sembilan
void main()
{
clrscr();
family pamilya; //Object of Class
int option;
ofstream out_file; //cout sa Filestream
char file[80];
char familyname[80];
node *l1,*l2,*r1,*r2,master;
l1 =new node;
l2=l1;
r1=new node;
r2=r1;
char a,b;
out_file.open(file);
clrscr();
cout<<"Masukkan nama keluarga Anda: ";gets(familyname);
cout<<"\n\nThank You! Press Any Key to Continue";
getch();
clrscr();
int nX = 2, nY = 2; //pang scroll
int ch; //inequate sa getch()
do{
clrscr();
cout<
cout<<"\n[2] Edit Element";
cout<<"\n[3] Hapus Left Child (nama anak)";
cout<<"\n[4] Hapus Right Child(nama cucu)";
cout<<"\n[5] cari Left Child (nama anak)";
cout<<"\n[6] cari Right Child (nama cucu)";
cout<<"\n[7] Tampilkan nama anak";
cout<<"\n[8] Tampilkan nama cucu";
cout<<"\n[10] Exit";
cin>>option;
switch (option)
{
case 1: //Every element will be asked to input left and right childs, pero optional un kung ndi nya llagyan...
{
flagleft:
clrscr();
cout<<"Left Child (nama anak):\n";
pamilya.addleft(l2);
cout<<"Apakah Anda ingin menambah nama Left Child (anak)? [y/n]";
cin>>a;
if(a=='y')
{l2->left=new node;
l2=l2->left;
goto flagleft;}
l2->left=NULL;
getch();
}
{
flagright:
clrscr();
cout<<"nama cucu (Right Child):\n";
pamilya.addright(r2);
cout<<"Apakan Anda ingin menambah nama Right Child (cucu)? [y/n]";
cin>>b;
if(b=='y')
{r2->right=new node;
r2=r2->right;
goto flagright;}
r2->right=NULL;
getch();
break;
}
case 2: //String Compare, if yes, overwrite, if no matches, tatanungin ule
{
cout<<"Type new name: ";
getch();
break;
}
case 3: //String Compare na lang siguro ule...
{
pamilya.delleft(l1);
cout<<"Deleted!";
getch();
break;
}
case 4:
{
pamilya.delright(r1);
cout<<"Deleted!";
getch();
break;
}
case 5: //String Compare
{clrscr();
pamilya.searchleft(l1);
getch();
break;
}
case 6: //String Compare
{clrscr();
pamilya.searchright(r1);
getch();
break;
}
case 7: //Lahat ng Left
{
cout<<"\n\n\n\nberikut ini adalah element dari left childs (anak): \n";
pamilya.findleft(l1);
getch();
break;
}
case 8: //Lahat ng Right
{
cout<<"\n\n\n\nberikut ini adalah element dari right childs (cucu): \n";
pamilya.findright(r1);
getch();
break;
}
case 9: //Naka notepad?? Pano iddrawing ung branches??
{
getch();
break;
}
case 10:
{
cout<<"\n\nThank You!";
break;
}
default:
cout<<"\n\nAnda salah PILIH!";
getch();
break;
}
}while(option!=10);
getch();
}
Label:
programming
Langganan:
Posting Komentar (Atom)
5 komentar:
mas koq aku dh coba programnya msh bnyk salahnya sih..............
coba includenya ditambahkan
coba includenya ditambahkan
coba includenya ditambahkan
include.a apa aja bang?
Posting Komentar