#include
<cstdlib>
#include
<iostream>
using
namespace std;
class Volume{
friend ostream& operator<<(ostream&,
Volume&);
friend istream&
operator>>(istream&, Volume&);
public:
Volume();
void volume_kubus(){
volume=s*s*s;
}
private:
int s;
int volume;
};
Volume::Volume(){
cout<<"PROGRAM MENGHITUNG
VOLUME KUBUS"<<endl;
}
istream& operator>>(istream& in,
Volume& masukan){
cout<<"Masukkan
sisi:";
in>>masukan.s;
return in;
}
ostream& operator<<(ostream&
out, Volume& keluaran){
out<<"sisi
kubus:"<<keluaran.s<<endl;
out<<"Volume Kubus
:"<<keluaran.volume<<endl;
return out;
}
int
main(int argc, char *argv[])
{
Volume x;
cin>>x;
x.volume_kubus();
cout<<x;
system("PAUSE");
return EXIT_SUCCESS;
}
Tidak ada komentar:
Posting Komentar