Program Menghitung Bangun Ruang dan Bangun Datar (Dev C++)
#include<iostream>
#include<math.h>
using namespace std;
main()
{
int software;
cout<<" SOFTWARE PENGHITUNG BANGUN DATAR DAN BANGUN RUANG\n";cout<<endl;
cout<<" 1. BANGUN DATAR\n";
cout<<" 2. BANGUN RUANG\n";
cout<<endl<<endl;
cout<<" BANGUN YANG AKAN ANDA HITUNG = ";cin>>software;
switch(software)
{
case 1:
int dtr;
cout<<endl<<endl<<" LUAS DAN KELILING BANGUN DATAR\n"<<endl;
cout<<"1. PERSEGI\n";
cout<<"2. LAYANG-LAYANG\n";
cout<<"3. SEGITIGA\n";
cout<<"4. LINGKARAN\n";
cout<<" BANGUN YANG AKAN ANDA HITUNG = ";cin>>dtr;
switch(dtr)
{
double s,L,K,phi,r,a,t,sm,d1,d2,sa,sb,p,l;
case 1:
cout<<endl<<endl<<" PERSEGI\n"<<endl;
cout<<"Masukan sisi persegi = ";cin>>s;
(L=s*s);
cout<<"LUAS = ";cout<<L<<endl;
(K=s*4);
cout<<"KELILING = ";cout<<K<<endl;
break;
case 2:
cout<<endl<<endl<<" LAYANG-LAYANG\n"<<endl;
cout<<" Diagonal 1 = ";cin>>d1;
cout<<" Diagonal 2 = ";cin>>d2;
(L=d1*d2*0.5);
cout<<"LUAS = ";cout<<L<<endl;
(K=2*(d1+d2));
cout<<"KELILING = ";cout<<K<<endl;
break;
case 3:
cout<<endl<<endl<<" SEGITIGA\n"<<endl;
cout<<" Panjang Alas = ";cin>>a;
cout<<" Tinggi = ";cin>>t;
(sm=sqrt((a*a)+(t*t)));
cout<<" Sisi Miring = ";cout<<sm<<endl;
(L=a*t/2);
cout<<"LUAS = ";cout<<L<<endl;
(K=sm*2+a*2);
cout<<"KELILING = ";cout<<K<<endl;
break;
case 4:
cout<<endl<<endl<<" LINGKARAN\n"<<endl;
cout<<" jari-jari lingkaran = ";cin>>r;
phi=3.14;
(L=phi*r*r);
cout<<"LUAS = ";cout<<L<<endl;
(K=2*phi*r);
cout<<"KELILING = ";cout<<K<<endl;
break;
default: cout<<" MASUKKAN DATA DENGAN BENAR... !\n";
}
break;
case 2:
int rang;
cout<<endl<<endl<<" LUAS PERMUKAAN DAN VOLUME BANGUN RUANG\n"<<endl;
cout<<"1. BOLA\n";
cout<<"2. KUBUS\n";
cout<<"3. KERUCUT\n";
cout<<"4. TABUNG\n";
cout<<" BANGUN YANG AKAN ANDA HITUNG = ";cin>>rang;
switch(rang)
{
double LP,V,t,s,r,phi;
case 1:
cout<<endl<<endl<<" BOLA\n"<<endl;
cout<<" Jari-Jari = ";cin>>r;
(LP=4*3.14*r*r);
cout<<"LUAS PERMUKAAN = ";cout<<LP<<endl;
(V=1.3*3.14*r*r*r);
cout<<"VOLUME = ";cout<<V<<endl;
break;
case 2:
cout<<endl<<endl<<" KUBUS\n"<<endl;
cout<<" Sisi = ";cin>>s;
(LP=6*(s*s));
cout<<" LUAS PERMUKAAN = ";cout<<LP<<endl;
(V=s*s*s);
cout<<" VOLUME = ";cout<<V<<endl;
break;
case 3:
cout<<endl<<endl<<" KERUCUT\n"<<endl;
cout<<" Tinggi = ";cin>>t;
cout<<" Jari-jari = ";cin>>r;
(s=sqrt((r*r)+(t*t)));
cout<<" Sisi = ";cout<<s<<endl;
phi=3.14;
(LP=(phi*r)*(r+s));
cout<<" LUAS PERMUKAAN = ";cout<<LP<<endl;
(V=(phi*r*r*t)/3);
cout<<" VOLUME = ";cout<<V<<endl;
break;
case 4:
cout<<endl<<endl<<" TABUNG\n"<<endl;
cout<<" Jari-jari Alas = ";cin>>r;
cout<<" Tinggi = ";cin>>t;
phi=3.14;
(LP=(2*(phi*r*r))+(2*(phi*r*r*t)));
cout<<" LUAS PERMUKAAN = ";cout<<LP<<endl;
(V=phi*r*r*t);
cout<<" VOLUME = ";cout<<V<<endl;
break;
default: cout<<" MASUKKAN DATA DENGAN BENAR... !\n";
}
break;
}
}
char LG;
cout<<"\n \n\n Ulangi Lagi [ Y/T ] ?";cin>>LG;
if (LG=='Y' || LG=='y')main();
else if (LG=='T' || LG=='t') goto x;
x:
cout<<"Terima Kasih \n";
cout<<"good bye ^_^";
} }
Hasil Compile
Selasa, 24 Desember 2013
Program Menghitung Bangun Ruang dan Bangun Datar (Dev C++)
Share this
Related Articles :
Langganan:
Posting Komentar (Atom)
Paling Dilihat
-
Program Mengurutkan Angka Kecil Ke Besar (Dev C++) #include<iostream> #include<conio.h> using namespace std; int main() ...
-
Program Perkalian Matrik Ordo 2x2 ( Dev C++ ) #include <iostream> #include <conio.h> using namespace std; int main(voi...
-
Program Menghitung Luas segitiga ( Dev C++ ) #include <iostream> using namespace std; int main(int argc, char *argv[]) { int a,...
-
Program Penjumlahan dan Pengurangan Matrik Ordo 3x3 (Dev C++) #include<stdio.h> #include<conio.h> using namespace std; i...
-
Kali Ini admin mau share ni cara membuat kalkulator sederhana menggunakan bahasa C tepatnya menggunakan aplikasi pemrograman Borland C++ ,...
-
Program Menghitung Bangun Ruang dan Bangun Datar (Dev C++) #include<iostream> #include<math.h> using namespace std; main...
Diberdayakan oleh Blogger.
0 komentar
Posting Komentar