c++ 질문드립니다..
걸때
무성의한 소스 요구는 ff0000금지합니다.
#include ccc_win.h
#include polygon.h
#include cmath
Polygon::Polygon()
{ }void Polygon::add_point(Point p) // add a point to the polygon
{ corners.push_back(p);
}void Polygon::plot() const // plot the edges of the polygon
{ int i;
int n = corners.size();
for (i = 0; i n; i++)
cwin Line(corners[i], corners[(i + 1) % n]);
}
int ccc_win_main()
{ Polygon triangle;
triangle.add_point(Point(0,0));
triangle.add_point(Point(0, 5));
triangle.add_point(Point(5,5 ));
triangle.plot();
const double PI = 3.141592653589793;
Polygon pentagon;
int i;
for (i = 0; i 3; i++)
pentagon.add_point(Point(cos(2 * PI * i / 3),
sin(2 * PI * i / 3)));
pentagon.plot();
return 0;
}
이 소스를 이용하여 정삼각형을 좌표평면에 표현해야되는데 어떻게 구현하는지좀 ㅠㅠ 도움 부탁드립니다!감사합니다 ㅠㅠ
-
큰애
첫번째 트라이앵클 클래스는 삼각형이나오고
두번째 pentagon 은 오각형이나옵니다^^ 여러번 시도끝에 정삼각형 다 만들었습니다.
답변 감사합니다. -
일본어못해요
구현 다 되어있는것 같은데요
저 소스코드 실행하면 어떻게 나오는지좀 설명 해주시겠어요?
포함 파일이 있어서요 컴파일이 안되네요