This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Rabu, 19 September 2012

OVERLOADING VOLUME BOLA


postingan kali ini tentang overloading untuk menentukan volume bola,
program c++ seperti dibawah ini silahakan disimak:
[sourcecode language="css"]
#include <cstdlib>
#include <iostream>
#include <conio.h>

using namespace std;

class Volume {
 friend ostream& operator<<(ostream&, const Volume&);
 friend istream& operator>>(istream&, Volume&);

 public:
 void Volume_bola();

private:
 int r;
 float hasil;
 };
 istream& operator>>(istream& in, Volume& masukan){
 cout<<"Menghitung Volume Bola\n";
 cout<<"Masukkan jari-jari(r) : ";
 cin>>masukan.r;

 return in;
 }

ostream& operator<<(ostream& out, const Volume& keluaran){
 out<<endl;
 out<<"Jari-jari (r) : "<<keluaran.r<<endl;
 out<<"Hasil Volume Bola adalah : "<<keluaran.hasil<<endl;
 return out;
 }
 void Volume::Volume_bola(){
 hasil=(4/3*3.14*r*r*r);
 }

main(){
Volume x;
cin>>x;
x.Volume_bola();
cout<<x;

system("PAUSE");
getch();
}

[/sourcecode]