#include <cstdlib>
#include <iostream>
using namespace std;
double volume_limas(double, double, double); //definision variabel volume limas
double volume_kerucut(double, double); //definision variabel voleme kerucut
double volume_bola(double); //definision variabel volume bola
double volume_limas(double p, double l, double t) //deklarasion fungsi
{
return((p*l*t)/3); //rumus
}
double volume_kerucut(double r, double t) //deklarasion fungsi
{
return((3.14*r*r*t)/3); //rumus
}
double volume_bola(double r) //deklarasion fungsi
{
return((4*3.14*r*r*r)/3); //rumus
}
int main(int argc, char *argv[])
{
double x,y,z,a,b,c;
cout << "**********************" << endl;
cout << " Mencari volume limas " << endl;
cout << "**********************" << endl;
cout << " Masukkan Panjang : " ;
cin >> x;
cout << " Masukkan Lebar : " ;
cin >> y;
cout << " Masukkan Tinggi : " ;
cin >> z;
cout << endl;
cout << " Volume Bola : " << volume_limas(x,y,z) << endl;
cout << endl;
cout << "************************" << endl;
cout << " Mencari Volume Kerucut " << endl;
cout << "************************" << endl;
cout << " Masukkan Jari-jari : " ;
cin >> a;
cout << " Masukkan Tinggi : " ;
cin >> b;
cout << endl;
cout << " Volume Kerucut : " << volume_kerucut(a,b) << endl;
cout << endl;
cout << "*********************" << endl;
cout << " Mencari Volume Bola " << endl;
cout << "*********************" << endl;
cout << " Masukkan Jari-jari : " ;
cin >> c;
cout << endl;
cout << " Volume Bola : " << volume_bola(c) << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Dan ketika di compile maka hasilnya akan tampak seperti gambar yang ada di bawah ini :
0 comments:
Posting Komentar