Thursday, December 23, 2010
C++
Fungsi (Mencari Volume Bola, Balok & Kubus menggunakan)
#include <iostream.h>
#include <conio.h>
double vbola(double);
double vkubus(double);
double vbalok(double, double, double);
double vbola(double r){
return((4*3.14*r*r*r)/3);
}
double vkubus(double s){
return(s*s*s);
}
double vbalok(double p, double l, double t){
return(p*l*t);
}
int main()
{
double x,y,z,a,b;
cout << "Mencari Volume Bola\n";
cout << "Masukkan Jari2\t: ";
cin >>a;
cout << "Hasil Volume Bola \t= " << vbola(a) << endl;
cout << "\nMencari Volume Kubus\n";
cout << "Masukkan Sisi: ";
cin >>b;
cout << "Hasil Volume Kubus \t= " << vkubus(b) << endl;
cout << "\nMencari Volume Balok\n";
cout << "Masukkan Panjang\t: ";
cin >>x;
cout << "Masukkan Lebar \t: ";
cin >>y;
cout << "Masukkan Tinggi \t: ";
cin >>z;
cout << "Hasil Volume Balok = " << vbalok(x,y,z) << endl;
getch();
return 0;
}
0 Response to " Fungsi (Mencari Volume Bola, Balok & Kubus menggunakan) "
Post a Comment