Minggu, 17 Januari 2010

Program Utama di C++

void main(){
int data[10];
int jum,max,min;
int pilih;
char lagi='y';
do {
clrscr();
cout<<"\n1. Cari nilai maxsimum"; cout<<"\n2. Cari nilai Minimum"; cout<<"\n3. cari rata-rata"; cout<<"\n4. Bubel sort"; cout<<"\n5. Insertion sort"; cout<<"\n6. Kata Polindrom"; cout<<"\n7. irisan"; cout<<"\n8. Pengurangan"; cout<<"\n9. Penggabungan"; cout<<"\n10.Perkalian matrik"; cout<<"\n11.Hitung massa tubuh"; cout<<"\n12.Data mahasiswa"; cout<<"\nPilihan = "; cin>>pilih;
switch (pilih){
case 1: {cout<<"Jumlah data yang ingin di inputkan :"; cin>>jum;
for (int i=0; i>data[i];
}
tampilan(data,jum);
max=maksimum(data,jum);
cout<<"\nNilai Maxsimumnya :"<>jum;
for (int i=0; i>data[i];
}
tampilan(data,jum);
minimum(data,jum,&min);
cout<<"\nNilai minimumnya :"<>jum;
for (int i=0; i>data[i];
}
tampilan(data,jum);
rata2(data,jum);
break;
}
case 4:{ int p;
do{
clrscr();
cout<<"\t\tPengurutan bubel sort"; cout<<"\n1. Askending "; cout<<"\n2. Deskending"; cout<<"\nMasukan Pilihan anda :";cin>>p;
switch (p){
case 1: { cout<<"\nMasukan Jumlah data :";cin>>jum;
for (int i=1; i<=jum; i++){ cout<<"\nMasukan data ke "<>data[i];
}
bubel_as(data,jum);
break;
}
case 2: { cout<<"\nMasukan Jumlah data :";cin>>jum;
for (int i=1; i<=jum; i++){ cout<<"\nMasukan data ke "<>data[i];
}
bubel_ds(data,jum);
break;
}
default: cout<<"\nBukan pilihan falid"; } }while (p !=1 && p!=2); break; } case 5: { int p; do{ clrscr(); cout<<"\t\tPengurutan isertion sort"; cout<<"\n1. Askending "; cout<<"\n2. Deskending"; cout<<"\nMasukan Pilihan anda :";cin>>p;
switch (p){
case 1: { cout<<"\nMasukan Jumlah data :";cin>>jum;
for (int i=1; i<=jum; i++){ cout<<"\nMasukan data ke "<>data[i];
}
isert_as(data,jum);
break;
}
case 2: { cout<<"\nMasukan Jumlah data :";cin>>jum;
for (int i=1; i<=jum; i++){ cout<<"\nMasukan data ke "<>data[i];
}
insert_ds(data,jum);
break;
}
default: cout<<"\nBukan pilihan falid"; } }while (p !=1 && p!=2); break; } case 6: { char kata[20]; clrscr(); cout<<"\nmasukan kata :";cin>>kata;
polindrom(kata);
break;
}
case 7: { int A[10],B[10];
int jum;
clrscr();
cout<<"\nMasukan jumlah data :";cin>>jum;
for (int i=1; i<=jum; i++){ cout<<"\nmasukan Nilai array A yang ke "<>A[i];
}
for (int j=1; j<=jum; j++){ cout<<"\nmasukan Nilai array B yang ke "<>B[j];
}
irisan(A,B,jum);
break;
}
case 8: { int A[10],B[10];
int jum;
clrscr();
cout<<"\nMasukan jumlah data :";cin>>jum;
for (int i=1; i<=jum; i++){ cout<<"\nmasukan Nilai array A yang ke "<>A[i];
}
for (int j=1; j<=jum; j++){ cout<<"\nmasukan Nilai array B yang ke "<>B[j];
}
kurang(A,B,jum);
break;
}
case 9: { int A[10],B[10];
int jum1,jum2;
clrscr();
cout<<"\nMasukan jumlah data array A :";cin>>jum1;
for (int i=0; i>A[i];
}
cout<<"\nMasukan jumlah data array B :";cin>>jum2;
for (int j=0; j>B[j];
}
gabung(A,B,jum1,jum2);
break;
}

case 10: {
perkalian();
break;
}
case 11: {
float berat,tinggi;
int jk;
cout<<"Masukan berat badan anda dalam kilogram :";cin>>berat;
cout<<"Masukan tinggi badan anda dalam satuan meter :";cin>>tinggi;
cout<<"Jenis kelamin anda L=1 P=2:";cin>>jk;
massa(berat,tinggi,jk);
break;
}
case 12: {
int jum;
cout<<"Jumlah mahasiswa :";cin>>jum;
mhs(jum);
break;
}

default: cout<<"\nBukan pilihan falid"; } cout<<"\nUlangi (y/t) ??"; cin>>lagi;
} while (toupper (lagi)=='y');
}

0 comments:

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Enter your email address to subscribe:

Delivered by FeedBurner

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | SharePoint Demo