#include <conio.h>
#include <iostream.h>
class beda {
friend istream& operator>>(istream&, beda&);
public :
beda(){};
void bedakan(){
if ((2*p+2*l)%4==0)
cout<<"persegi";
else
cout<<"persegi panjang";
}
private :
int p, l;
};
istream& operator>>(istream& in, beda& masukan){
cout<<"masukkan panjang = ";
in>>masukan.p;
cout<<"masukkan lebar = ";
in>>masukan.l;
return in;
}
main (){
beda masukan;
cin>>masukan;
masukan.bedakan();
getch();
}
Komentar :
Posting Komentar