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;
}
#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();
}
Program C++ Menghitung Volume Bola >>>>> Download Now
ReplyDelete>>>>> Download Full
Program C++ Menghitung Volume Bola >>>>> Download LINK
>>>>> Download Now
Program C++ Menghitung Volume Bola >>>>> Download Full
>>>>> Download LINK CZ