#include
#include
#define phi 3.14
main()
{
//deklarasi bola
float vbola,rbola,lbola;
char nodaftarbola [20] [20];
int jumdatabola ,indekbola ,databola ;
//deklarasi tabung
float rtabung,ttabung,vtabung,ltabung;
char nodaftartabung [20] [20];
int jumdatatabung,indektabung,datatabung;
//deklarasi kerucut
double rkerucut, tkerucut, vkerucut, lkerucut;
char nodaftarkerucut [20] [20];
int jumdatakerucut,indekkerucut,datakerucut;
//delkarasi global
int pilih,pilihan;
char jawab,g,s;
jumdatabola=0;
jumdatatabung=0;
jumdatakerucut=0;
databola=0;
datatabung=0;
datakerucut=0;
indekbola=1;
indektabung=1;
indekkerucut=1;
menu :
clrscr();
gotoxy(2,1) ;printf("STMIK PALANGKA RAYA ");
gotoxy(2,2) ;printf("PEMPROGRAMAN C++ ");
gotoxy(59,1) ;printf("Nama : DODY SAPUTRA");
gotoxy(59,2) ;printf("NIM : E1257401 018 ");
gotoxy(28,9) ;printf("##########################");
gotoxy(28,10) ;printf("# *MENU UTAMA* #");
gotoxy(28,11) ;printf("#========================#");
gotoxy(28,12) ;printf("# 1. Input #");
gotoxy(28,13) ;printf("# 2. Delete #");
gotoxy(28,14) ;printf("# 3. Exit #");
gotoxy(28,15) ;printf("##########################");
gotoxy(29,17) ;printf("Masukkan Pilihan [1-3] : "),cin>>pilih;
switch (pilih)
{
case 1:
{
clrscr();
gotoxy(2,1) ;printf("STMIK PALANGKA RAYA ");
gotoxy(2,2) ;printf("PEMPROGRAMAN C++ ");
gotoxy(59,1) ;printf("Nama : xxx");
gotoxy(59,2) ;printf("NIM : xxx ");
gotoxy(28,9) ;printf("#########################");
gotoxy(28,10) ;printf("# SUB.MENU INPUT #");
gotoxy(28,11) ;printf("#=======================#");
gotoxy(28,12) ;printf("# 11. Bolla #");
gotoxy(28,13) ;printf("# 12. Tabung #");
gotoxy(28,14) ;printf("# 13. Kerucut #");
gotoxy(28,15) ;printf("# 14. Menu #");
gotoxy(28,16) ;printf("#########################");
gotoxy(28,18) ;printf("Masukkan Pilihan [11-14] :"),cin>>pilihan;
if (pilihan==11)
{
clrscr();
inputbola:
gotoxy(23,1) ;printf(" <<< BOLLA >>>");
gotoxy(23,2) ;printf("=========================================");
cout<<"\n\n\n";
cout<<" Masukkan Banyak Data : ",cin>>databola;
jumdatabola=jumdatabola+databola;
cout<<"\n";
for (indekbola;indekbola<=jumdatabola;indekbola++)
{
cout<<" No. "<
lbola=4*phi*rbola*rbola;
vbola=phi*4/3 *rbola*rbola*rbola;
cout<<"\n luas Bola : "<
}
gotoxy(17,35) ;printf("Apakah Anda ingin menambahkan Data lagi (Y/T) ??? ");
cin>>jawab;
if (jawab=='Y' || jawab=='y'){
clrscr ();
goto inputbola;}
else{
clrscr ();
goto menu;}
}
if (pilihan==12)
{
clrscr();
inputtabung:
gotoxy(23,1) ;printf(" <<< TABUNG >>>");
gotoxy(23,2) ;printf("=========================================");
cout<<"\n\n\n";
cout<<" Masukkan Banyak Data : ",cin>>datatabung;
jumdatatabung=jumdatatabung+datatabung;
cout<<"\n";
for (indektabung;indektabung<=jumdatatabung;indektabung++)
{
cout<<" No. "<
cout <<" Masukkan Tinggi : "; cin >>ttabung;
ltabung=((phi*rtabung*2)*rtabung)+((phi*rtabung*2)*ttabung);
vtabung=phi*rtabung*rtabung*ttabung;
cout<<"\n Luas Tabung : "<
}
gotoxy(17,35) ;printf("Apakah Anda ingin menambahkan Data lagi (Y/T) ??? ");
cin>>jawab;
if (jawab=='Y' || jawab=='y')
{
clrscr ();
goto inputtabung;}
else{
clrscr ();
goto menu;}
}
if (pilihan==13)
{
clrscr();
inputkerucut:
gotoxy(23,1) ;printf(" <<< KERUCUT >>>");
gotoxy(23,2) ;printf("=========================================");
cout<<"\n\n\n";
cout<<"\n Masukkan Banyak Data : ",cin>>datakerucut;
jumdatakerucut=jumdatakerucut+datakerucut;
cout<<"\n\n";
for (indekkerucut;indekkerucut<=jumdatakerucut;indekkerucut++)
{
cout<<" No. "<
cout <<"\n Masukkan Tinggi : "; cin >>tkerucut;
lkerucut=phi*rkerucut*rkerucut;
vkerucut=(lkerucut*tkerucut)/3;
cout <<"\n Luas Kerucut : "<
}
gotoxy(17,35) ;printf("Apakah Anda ingin menambahkan Data lagi (Y/T) ??? ");
cin>>jawab;
if (jawab=='Y' || jawab=='y')
{
clrscr ();
goto inputkerucut;}
else{
clrscr ();
goto menu;
}
if (pilihan==14)
{
gotoxy(23,35) ;printf("Apakah Anda Yakin Ingin Keluar (Y/T)??? ");cin>>g;
if (g=='Y'||g=='y')
{
clrscr ();
goto menu;}
}
}
case 2:
{
clrscr();
gotoxy(2,1) ;printf("STMIK PALANGKA RAYA ");
gotoxy(2,2) ;printf("PEMPROGRAMAN C++ ");
gotoxy(59,1) ;printf("Nama : DODY SAPUTRA");
gotoxy(59,2) ;printf("NIM : E1257401 018 ");
gotoxy(25,9) ;printf("##################################");
gotoxy(25,10) ;printf("# SUB.MENU DELETE #");
gotoxy(25,11) ;printf("#================================#");
gotoxy(25,12) ;printf("# 21. Delete Data Bola #");
gotoxy(25,13) ;printf("# 22. Delete Data Tabung #");
gotoxy(25,14) ;printf("# 23. Delete Data Kerucut #");
gotoxy(25,15) ;printf("# 24. Menu #");
gotoxy(25,16) ;printf("##################################");
gotoxy(25,18) ;printf("Masukkan Pilihan [21-24] :"),cin>>pilihan;
if (pilihan==21)
{
clrscr();{
gotoxy(13,13) ;printf("Apakah Anda yakin ingin menghapus semua Data (Y/T)??? "); cin>>g;
if (g=='y'||g=='Y')
{
indekbola=0;
jumdatabola=0;
goto menu;}
else{
goto menu;}
}
}
if (pilihan==22)
{
clrscr();{
gotoxy(13,13) ;printf("Apakah Anda yakin ingin menghapus semua Data (Y/T)??? "); cin>>g;
if (g=='y'||g=='Y')
{
indektabung=0;
jumdatatabung=0;
goto menu;}
else{
goto menu;}
}
}
if (pilihan==23)
{
clrscr();{
gotoxy(13,13) ;printf("Apakah Anda yakin ingin menghapus semua Data (Y/T)??? "); cin>>g;
if (g=='y'||g=='Y')
{
indekkerucut=0;
jumdatakerucut=0;
goto menu;}
else{
goto menu;}
}
}
if (pilihan==24)
{
gotoxy(23,35) ;printf("Apakah Anda Yakin Ingin Keluar (Y/T)??? ");cin>>g;
if (g=='Y'||g=='y')
{
clrscr ();
goto menu;}
}
}
case 3:
{
gotoxy(23,35) ;printf("Apakah Anda Yakin Ingin Keluar (Y/T)??? ");cin>>g;
if (g=='Y'||g=='y')
{
clrscr ();
gotoxy(22,12) ;printf(" TERIMA KASIH ");
gotoxy(22,13) ;printf(" TELAH MENGGUNAKAN PROGRAM INI ");
gotoxy(22,14) ;printf(" ========================================");
}
else{
clrscr ();
goto menu;}
}
}
}
}