Program C++ Menghitung Volume Bola

Algoritma :

Deskripsi

r : integer
volume : float

Deklarasi
volume <= 4/3*3.14*r*r*r
write (volume)

Berikut Programnya :



#include<iostream.h>

#include<conio.h>

void bola()
{
  int r,volume;
  cout<<"masukan nilai jari-jari : ";
  cin>>r;
  cout<<"volume bola = "<<4/3*3.14*r*r*r<<endl;
}

int main() {

    bola();
    return 0;
}


Program Classnya :

#include <iostream.h>
#include <conio.h>

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

public:
volume();
void hitung_volumenya(){ volume = 4/3*3.14*r*r*r;}

private:
    int r;
    float volume;
};

volume::volume(){
cout << "Program mencari volume bola \n" << endl;
}
istream& operator >>(istream& cin, volume& masukan){
   cout << "Masukkan jari-jari : ";   cin >> masukan.r;
   cout<<endl;

return cin;
}
ostream& operator << (ostream& out, const volume& keluaran)
{
  out<< " Nilai jari- jari : " <<keluaran.r<<endl;
  out<< " volume bola = "<<keluaran.volume<<endl;

return out;
}

void main(){
  volume bola;
  cin>>bola;
  bola.hitung_volumenya();
  cout<<bola;

  getch();

}




Comments

  1. Program C++ Menghitung Volume Bola >>>>> Download Now

    >>>>> Download Full

    Program C++ Menghitung Volume Bola >>>>> Download LINK

    >>>>> Download Now

    Program C++ Menghitung Volume Bola >>>>> Download Full

    >>>>> Download LINK CZ

    ReplyDelete

Post a Comment

Popular posts from this blog

Nero 8.3.6.0 + Serial Number (Crack)

Contoh Script HTML Untuk Menyatakan Cinta

Soal Teori Kejuruan TKJ Kelas XII 2016/2017