Sabtu, 09 April 2011

Determining Program Area of ​​Circles & Balls Volume

# Include <iostream>  
# Include <conio> 

  
class count {
   
friend ostream & operator <<(ostream &, const count &);
   
friend istream & operator>> (istream &, & count); public:
  

 count ();
   
hitung_luas void () {area = (3.14 * r * r);}    / / formula to find area of ​​a circle
   
hitung_volum void () {volume = (3.14 * (r * r * r) * 4 / 3);}    / / formula to find the volume of the ball.
  
private:
   
int r int wide; float volume;     / / declaring variables that will be used
   
}; 


count:: count () {
    
court <<"Counting Program Area of ​​Circles and Balls Volume: \ n";
   


istream & operator>> (istream & ins, count & input)   {/ * input function to call the class count * /
   
court <<"Enter the value jari2:"; in>> masukkan.r;    / / input value of the radius
   
return ins;  



ostream & operator <<(ostream & out, const count & output) {
  
out <<"The value of r:" <<keluaran.r <<endl <<endl;
  
out <<"broad circle:" <<keluaran.luas <<endl;
  
out <<"volume of the ball:" <<keluaran.volum <<endl;   / * court or the output of the value of r, n lingkran Area Volume of ball * /
  
return out;
  
}

  
main () {
  
count x;      / / x function to replace the class count
  
cin>> x;    / / input value x (the radius).
  
x.hitung_luas ();     / / call the formula area of ​​a circle that is in a class count
  
x.hitung_volum ();    / / call volume sphere formula that is in a class count
  
court <<x;    / / results
  
getch ();
  
return 0;
  
}

Tidak ada komentar:

Posting Komentar