#include <cstdlib>
#include <iostream>
using namespace std;
class luas{
public:
void lingkaran();
void volume();
private:
float r;
float phi;
float hasil;
};
void luas::lingkaran(){
cout<<"Luas Lingkaran"<<endl;
cout<<"Masukan r:";
phi=3.14;
cin>>r;
hasil=4*phi*r*r;
cout<<"Luas Lingkaran:"<<hasil<<endl;
}
void luas::volume(){
cout<<endl;
cout<<"Volume Bola"<<endl;
cout<<"Masukan r:";
phi=3.14;
cin>>r;
hasil=(4/3)*phi*r*r*r;
cout<<"Volume Bola:"<<hasil<<endl;
}
int main(int argc, char *argv[])
{ luas x;
x.lingkaran();
x.volume();
system("PAUSE");
return EXIT_SUCCESS;
}
0 Response for the "Program Mencari Luas lingkaran dan Volume Bola"
Post a Comment