#include
#include
#include
#include

using namespace std;

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

public:

private:
int p,l,t;
int B;

};

istream& operator << (istream& in, balok& al);
cout<<"Program menghitung B = p * l * t \n";
cout<<"Masukkan Nilai p = ";
cout<<al.p;
cout<<"Masukkan Nilai l = ";
cout<<al.l;
cout<<"Masukkan Nilai t = ";
cout<<al.t;
al.B=al.p*al.l*al.t;
return in;
}
ostream& operator << (ostream& out, const balok& al){
cout<<"\nB = ";
out<<al.p;
cout<<" x ";
out<<al.l;
cout<<" x ";
out<<al.t;
cout<<" : “<<al.B;

main(){
balok el;
cin>>el;
cout>>el;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>