#include <cstdlib>
#include <iostream>
using namespace std;
class hit{
private:
double s,l,p,t,luba,voba,luku,voku;
double as,ts,tp,lp,vp,ls,ks;
double pi,r,vobo,lubo;
public:
double lubaku();
double lupris();
double lubol();
};
double hit::lubaku(){
cout<<"input lebar:";
cin>>l;
cout<<"input panjang:";
cin>>p;
cout<<"input tinggi:";
cin>>t;
cout<<"input sisi kubus:";
cin>>s;
luba=2*((p*l)+(p*t)+(l*t));
voba=p*l*t;
luku=6*(s*s);
voku=s*s*s;
cout<<"Volum Kubus: "<<voku<<endl;
cout<<"Volume Balok: "<<voba<<endl;
cout<<"Luas Permukaan Kubus: "<<luku<<endl;
cout<<"Luas Permukaan Balok: "<<luba<<endl;
cout<<endl;
}
double hit::lupris(){
cout<<"input alas segitiga: ";
cin>>as;
cout<<"input tinggi segitiga: ";
cin>>ts;
cout<<"input tinggi prisma: ";
cin>>tp;
ls=0.5*(as*ts);
ks=(2*ts)+as;
lp=(2*ls)+(ks*tp);
vp=ls*ts;
cout<<"Volume Prisma: "<<vp<<endl;
cout<<"Luas Permukaan Prisma: "<<lp<<endl;
cout<<endl;
}
double hit::lubol(){
cout<<"input jari-jari: ";
cin>>r;
pi=3.14;
lubo=4*pi*(r*r);
vobo=pi*(r*r*r);
cout<<"Luas Permukaan Bola: "<<lubo<<endl;
cout<<"Volume Bola: "<<vobo<<endl;
cout<<endl;
}
int main(int argc, char *argv[])
{
hit c;
c.lubaku();
c.lupris();
c.lubol();
system("PAUSE");
return EXIT_SUCCESS;
}
Tidak ada komentar:
Posting Komentar