#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#define phi 3.14
void main()
{
int pilih, pilih1, pilih2;
float s,lp;
float p,l,lpp;
float r,ll;
float a,t,ls;
float ab,at,tt,lt;
float aj,tj,lj;
float d1,d2,lbk;
float d1l,d2l,lly;
float ks,kh;
float kp,kl,kpp;
float kr,kln;
float s1,s2,s3,ks3;
float st1,st2,st3,st4,kt;
float sj1,sj2,kj;
float sbl,kbl;
float sl1,sl2,kll;
menu:
clrscr();
char garis[30]="=========================",jawab;
cout<<garis<<endl;
cout<<"|| Fellix Tara Edison ||"<<endl;
cout<<"|| 11201170 / B11 ||"<<endl;
cout<<garis<<endl<<endl;
cout<<"Menu Utama"<<endl;
cout<<endl<<endl;
cout<<"1. Menghitung Luas Bangun Datar"<<endl;
cout<<"2. Menghitung Keliling Bangun Datar"<<endl;
cin>>pilih;
clrscr();
switch (pilih)
{
case 1:
goto LBD;break;
case 2:
goto KBD;break;
default:
cout<<"Input Salah !!!(Pilihan'e 1 & 2 thokkk !!!)";
goto menu;
}
LBD:
clrscr();
cout<<"1. Menghitung Luas Persegi"<<endl;
cout<<"2. Menghitung Luas Persegi Panjang"<<endl;
cout<<"3. Menghitung Luas Lingkaran"<<endl;
cout<<"4. Menghitung Luas Segitiga"<<endl;
cout<<"5. Menghitung Luas Trapesium"<<endl;
cout<<"6. Menghitung Luas Jajar Genjang"<<endl;
cout<<"7. Menghitung Luas Belah Ketupat"<<endl;
cout<<"8. Menghitung Luas Layang - Layang"<<endl;
cout<<"00. Kembali Ke Menu"<<endl;
cin>>pilih1;
clrscr();
switch (pilih1)
{
case 1:
{
cout<<"Rumus : s x s"<<endl;
cout<<"Sisi = ";
cin>>s;
lp=s*s;
cout<<"Hasil = "<<lp;break;
}
case 2:
{
cout<<"Rumus : p x l"<<endl;
cout<<"Masukkan Panjang = ";
cin>>p;
cout<<"Masukkan Lebar = ";
cin>>l;
lpp=p*l;
cout<<"Hasil = "<<lpp;break;
}
case 3:
{
cout<<"Rumus : 3.14 x r x r"<<endl;
cout<<"Masukkan Jari = ";
cin>>r;
ll=phi*r*r;
cout<<"Hasil = "<<ll;break;
}
case 4:
{
cout<<"Rumus : 0.5 x a x t"<<endl;
cout<<"Masukkan Alas = ";
cin>>a;
cout<<"Masukkan Tinggi = ";
cin>>t;
ls=0.5*a*t;
cout<<"Hasil = "<<ls;break;
}
case 5:
{
cout<<"Rumus : 0.5 x (Sisi bawah + Sisi atas) x t"<<endl;
cout<<"Masukkan Sisi Bawah = ";
cin>>ab;
cout<<"Masukkan Sisi Atas = ";
cin>>at;
cout<<"Masukkan Tinggi = ";
cin>>tt;
lt=0.5*(ab+at)*tt;
cout<<"Hasil = "<<lt;break;
}
case 6:
{
cout<<"Rumus : a x t"<<endl;
cout<<"Masukkan Alas = ";
cin>>aj;
cout<<"Masukkan Tinggi = ";
cin>>tj;
lj=aj*tj;
cout<<"Hasil = "<<lj;break;
}
case 7:
{
cout<<"Rumus : Diagonal 1 x Diagonal / 2"<<endl;
cout<<"Masukkan Diagonal 1 = ";
cin>>d1;
cout<<"Masukkan Diagonal 2 = ";
cin>>d2;
lbk=d1*d2/2;
cout<<"Hasil = "<<lbk;break;
}
case 8:
{
cout<<"Rumus : Diagonal 1 x Diagonal / 2"<<endl;
cout<<"Masukkan Diagonal 1 = ";
cin>>d1l;
cout<<"Masukkan Diagonal 2 = ";
cin>>d2l;
lly=d1l*d2l/2;
cout<<"Hasil = "<<lly;break;
}
default:
goto menu;
}
cout<<endl<<endl;
cout<<"Apakah ingin mengulangi Menu Utama, Pilih Ulang, Keluar (M/P/K)???";
cin>>jawab;
switch(jawab)
{
case 'm':
case 'M':
goto menu;break;
case 'p':
case 'P':
goto LBD;break;
default:
goto end;
}
KBD:
clrscr();
cout<<"1. Menghitung Keliling Persegi"<<endl;
cout<<"2. Menghitung Keliling Persegi Panjang"<<endl;
cout<<"3. Menghitung Keliling Lingkaran"<<endl;
cout<<"4. Menghitung Keliling Segitiga"<<endl;
cout<<"5. Menghitung Keliling Trapesium"<<endl;
cout<<"6. Menghitung Keliling Jajar Genjang"<<endl;
cout<<"7. Menghitung Keliling Belah Ketupat"<<endl;
cout<<"8. Menghitung Keliling Layang - Layang"<<endl;
cout<<"00. Kembali Ke Menu";
cin>>pilih2;
clrscr();
switch (pilih2)
{
case 1:
{
cout<<"Rumus : 4 x s"<<endl;
cout<<"Masukkan Sisi = ";
cin>>ks;
kh=4*ks;
cout<<"Hasil = "<<kh;break;
}
case 2:
{
cout<<"Rumus : 2(p + l)"<<endl;
cout<<"Masukkan Panjang = ";
cin>>kp;
cout<<"Masukkan Lebar = ";
cin>>kl;
kpp=2*(kp+kl);
cout<<"Hasil = "<<kpp;break;
}
case 3:
{
cout<<"Rumus : 2 x 3.14 x r"<<endl;
cout<<"Masukkan Jari-Jari = ";
cin>>kr;
kln=2*phi*kr;
cout<<"Hasil = "<<kln;break;
}
case 4:
{
cout<<"Rumus : a + b + c"<<endl;
cout<<"Masukkan Sisi 1 = ";
cin>>s1;
cout<<"Masukkan Sisi 2 = ";
cin>>s2;
cout<<"Masukkan Sisi 3 = ";
cin>>s3;
ks3=s1+s2+s3;
cout<<"Hasil ="<<ks3;break;
}
case 5:
{
cout<<"Rumus : a + b + c + d"<<endl;
cout<<"Masukkan Sisi 1 = ";
cin>>st1;
cout<<"Masukkan Sisi 2 = ";
cin>>st2;
cout<<"Masukkan Sisi 3 = ";
cin>>st3;
cout<<"Masukkan Sisi 4 = ";
cin>>st4;
kt=st1+st2+st3+st4;
cout<<"Hasil = "<<kt;break;
}
case 6:
{
cout<<"Rumus : 2 (a + b)"<<endl;
cout<<"Masukkan Sisi 1 = ";
cin>>sj1;
cout<<"Masukkan Sisi 2 = ";
cin>>sj2;
kj=2*(sj1+sj2);
cout<<"Hasil = "<<kj;break;
}
case 7:
{
cout<<"Rumus : 4 x s"<<endl;
cout<<"Masukkan Sisi = ";
cin>>sbl;
kbl=4*sbl;
cout<<"Hasil = "<<kbl;break;
}
case 8:
{
cout<<"Rumus : 2 (a + b)"<<endl;
cout<<"Masukkan Sisi 1 = ";
cin>>sl1;
cout<<"Masukkan Sisi 2 = ";
cin>>sl2;
kll=2*(sl1+sl2);
cout<<"Hasil = "<<kll;break;
}
default:
goto menu;
}
cout<<endl<<endl;
cout<<"Apakah ingin mengulangi Menu Utama, Pilih Ulang, Keluar (M/P/K)???";
cin>>jawab;
switch(jawab)
{
case 'm':
case 'M':
goto menu;break;
case 'p':
case 'P':
goto KBD;break;
default:
goto end;
}
end:
}