document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /* Created by Amri Rachmat  */
  2.  
  3. #include <cstdlib>
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. class Bola {
  9.       friend ostream& operator<<(ostream&, const Bola&);
  10.       friend istream& operator>>(istream&, Bola&);
  11.      
  12.       public:
  13.              Bola();
  14.              void volume_bola(){volume=(4/3*3.14*r*r*r);}
  15.       private:
  16.               int r;
  17.               int volume;
  18.               };
  19.                                    
  20.       Bola::Bola() {
  21.                        cout<<"Program menghitung volume bola\\n";
  22.                        }
  23.      
  24.                        
  25.       istream& operator>>(istream& in, Bola& masukan) {
  26.                cout<<"Masukkan nilai jari-jari : "; in>>masukan.r;        
  27.                return in;
  28.                }
  29.                                
  30.       ostream& operator<<(ostream& out, const Bola& keluaran) {
  31.                out<<"Volume bolanya adalah :"<<keluaran.volume<<endl;
  32.                return out;
  33.                }
  34.  
  35. int main(int argc, char *argv[])
  36. {
  37.     Bola coba;
  38.     cin>>coba;
  39.     coba.volume_bola();
  40.     cout<<coba;
  41.    
  42.     system("PAUSE");
  43.     return EXIT_SUCCESS;
  44. }
');