#include <iostream.h>
class crectangle { private: int l;int t;int r;int b; public: void draw(void) { moveto(l,t); lineto(l,b); lineto(r,b); lineto(r,t); lineto(l,t); } void getcoord(int *L,int *T,int *R,int B) { *L=l; *T=t; *R=r; *B=b; } void setcoord(int Left ,int Top ,int Right,int Bottom) { l=Left;t=Top;r=Right;b=Bottom; } }
void main() { int l,t,r,b; crectangle rect; rect.setcoord(25,25,100,100); rect.draw(); rect.getcoord(&l,&t,&r,&b); cout<<"coordinate:"<<l<<"."<<t<<"."<<r<<"."<<b<<endl; }