yaa kali saya akan memberi program cara menghitung bangun ruang seperti balok,kubus,limas dan balok,Mengunakan bahasa c++
1.Balok
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int p,l,t;
int ac,af,bg;
double pjgdgnl,lsprmkn;
long volume;
float acge,adfg,abgf,c,f,g,pjg,ge,e,ad,d,ab,b,j,h;
cout<<" ++++++MENGHITUNG BALOK++++++ \n"<<endl<<endl;
cout<<"Misalkan Balok ABCDEFGH"<<endl;
cout<<"Dengan:"<<endl;
cout<<"Panjang Balok :";
cin>>p;
cout<<"Lebar Balok :";
cin>>l;
cout<<"Tinggi Balok :";
cin>>t;
cout<<endl;
ac=(p*p)+(l*l);
c=sqrt(ac);
af=(p*p)+(t*t);
f=sqrt(af);
bg=(l*l)+(t*t);
g=sqrt(bg);
cout<<"A.Diagonal Sisi:"<<endl;
cout<<" AC:"<<c<<endl;
cout<<" AF:"<<f<<endl;
cout<<" BG:"<<g<<endl;
pjgdgnl=(p*p)+(l*l)+(t*t);
pjg=sqrt(pjgdgnl);
lsprmkn=((p*l)+(p*t)+(l*t))/2;
volume=p*l*t;
acge=(p*p)+(l*l);
ge=sqrt(acge);
e=ge*t;
adfg=(p*p)+(t*t);
ad=sqrt(adfg);
d=ad*l;
abgf=(l*l)+(t*t);
ab=sqrt(abgf);
b=ab*p;
cout<<"B.Panjang diagonal ruang :"<<pjg<<endl;
cout<<"C.Luas Permukaan Balok :"<<lsprmkn<<endl;
cout<<"D.Volume Balok :"<<volume<<endl;
cout<<"E.Luas bidang diagonal ACGE :"<<e<<endl;
cout<<"F.Luas bidang diagonal ADGF :"<<d<<endl;
cout<<"G.Luas bidang diagonal ABGF :"<<b<<endl<<endl<<endl;
cout<<" HANYA MENGHITUNG BALOK YG MEMILIKI PANJANG,LEBAR DAN"; cout<<"TINGGI "<<endl;
return 0;
}
Tampilannya :
source code:
#include <iostream>
using namespace std;
int main()
{
int p,luas;
long volume;
cout<<" +Mengitung Kubus+\n "<<endl<<endl;
cout<<"Masukan Panjang Kubus:";
cin>>p;
luas=6*(p*p);
volume=p*p*p;
cout<<"Luas Permukaan Kubus :"<<luas<<endl;
cout<<"Volume Kubus :"<<volume<<endl<<endl;
cout<<"======INI PROGRAM SAYA TRIMAKASIH=======";
return 0;
}
Tampilanya:
3.Limas
source code;
#include <iostream>
using namespace std;
int main()
{
int la,ls,t,lp;
float volume;
cout<<" ++++++MENGHITUNG LIMAS++++++ /n "<<endl<<endl;
cout<<"Masuka:"<<endl;
cout<<"Luas alas :";
cin>>la;
cout<<"Jumlah Luas sisi tegak :";
cin>>ls;
cout<<"Tinggi Limas :";
cin>>t;
lp=la+ls;
volume=0.33*la*t;
cout<<"Hasilnya:"<<endl;
cout<<"Luas Permukaan Limas:"<<lp<<endl;
cout<<"Volume Limas :"<<volume<<endl<<endl;
cout<<"==========SEKIAN TRIMAKASIH=========="<<endl;
return 0;
}
tampilannya;
4.Prisma
source code
#include<iostream>
using namespace std;
int main()
{
int ka,t,ls,la;
float volume,lps;
cout<<" ++++++MENGHITUNG PRISMA SEGITGA DAN SEGILIMA++++++ \n"<<endl<<endl;
cout<<"Masukan:\n";
cout<<"Keliling Alas :";
cin>>ka;
cout<<"Tinggi Alas :";
cin>>t;
cout<<"Luas Alas :";
cin>>la;
ls=ka*t;
lps=(2*la)+ls;
volume=la*t;
cout<<"Hasilnya:"<<endl;
cout<<"Jumlah luas sisi tegak :"<<ls<<endl;
cout<<"Luas Permukaan Prisma :"<<lps<<endl;
cout<<"Volume Prisma :"<<volume<<endl<<endl;
cout<<" ========Sekian Trimakasih========"<<endl;
return 0;
}
tampilannya;
sekian dari saya
1 komentar: