Volume Bola

Posted: 1 Juli 2013 in Praktikum Alpro

Gambar

 

Source C++ :

#include <cstdlib>
#include <iostream>

using namespace std;

class Contoh{
public :
void inputan();
void bola();
// ~contoh ();
private :
int r;
int phi;
int volume_bola;
};

void Contoh::inputan(){
cout<<“Menghitung volume bola”<<endl;
cout<<“Masukkan jari-jari”<<endl;
cin >> r;

};

void Contoh::bola(){
phi =3,14;
volume_bola =(4/3)*phi*r*r*r;
cout <<“Volume bola adalah = “<< volume_bola << endl;
}

int main(){
Contoh x;
x.inputan();
x.bola();

system(“PAUSE”);
return EXIT_SUCCESS;
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s