|
#include <math.h>
class Coord
{
protected:
int x,y;
public:
Coord(int ax, int ay) { x=ax;y=ay; }
void GetXY(int &rx, int &ry) { rx=x;ry=y; }
void SetXY(int ax, int ay) { x=ax;y=ay; }
};
class Point : public Coord
{
protected:
char ch;
public:
Point(int ax, int ay, char ach) : Coord(ax,ay) { ch=ach; }
void Show() {
gotoxy(x,y);putch(ch);
}
void Hide() {
gotoxy(x,y);putch(' ');
}
};
class Circle : public Point
{
protected:
int Rad;
public:
Circle(int ax, int ay, char ach, int aRad) : Point(ax,ay,ach) { Rad=aRad; }
void Show() {
for (double a=0;a<360;a+=15) {
gotoxy(int(x+sin(a*3.14/180)*Rad),int(y-cos(a*3.14/180)*Rad));
putch(ch);
}
}
void Hide() {
for (double a=0;a<360;a+=15) {
gotoxy(int(x+sin(a*3.14/180)*Rad),int(y-cos(a*3.14/180)*Rad));
putch(' ');
}
}
};
이렇게 선언하고
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Point P(10,10,'@');
//P.Show();
//Circle C(40,10,'*',8);
//C.Show();
}
하였습니다.
gotoxy는 주석 처리
뭐가 문제일까요~ 문법을 잘몰라서 ㅠㅠ
|