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 >>(is