#include#include class beda { friend istream& operator>>(istream&, beda&); public : beda(){}; void bedakan(){ if (p==l) 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(); }
No comments:
Post a Comment