SDUST 평면의 점 및 선 - Point 클래스, 라인 클래스(III)
2435 단어 SDUST
Description
수학적으로 평면 직각 좌표계의 점은 X축과 Y축의 두 좌표값으로 유일하게 확정되고 두 점은 하나의 선분을 확정한다.이제 Point 클래스 및 라인 클래스를 패키지화하여 평면상의 점 작업을 수행합니다.
'append.cc' 에 따라 Point 클래스와 라인 클래스의 구조 방법과 show () 방법을 완성하고 각 라인 대상과 Point 대상의 구조와 분석 순서를 출력합니다.
인터페이스 설명: Point::show() 방법: Point 객체를 형식으로 출력합니다.Line:::show() 메서드:Line 객체를 형식으로 내보내기
Input
입력한 첫 번째 비헤이비어 N은 다음에 N 행 테스트 예제가 있음을 나타냅니다.모든 행위의 두 그룹 좌표인'x, y'는 선의 시작점과 끝점을 나타내는 x 좌표와 y 좌표이고 두 그룹 좌표 사이는 하나의 빈칸으로 나누며 x와 y의 값은 모두 더블 데이터 범위 내에 있다.
Output
출력은 여러 줄로 되어 있고 행동마다 한 줄로 되어 있으며 시작점 좌표는 앞점 좌표가 뒤에 있고 각 점의 X 좌표는 앞에 있고 Y 좌표는 뒤에 있으며 Y 좌표 앞에는 빈칸을 하나 더 출력하여 괄호로 감싸고 있다.출력 형식은 Sample을 보십시오.
C 언어의 입력과 출력이 비활성화되었습니다.
Sample Input
40,0 1,11,1 2,32,3 4,50,1 1,0 Sample Output
Point : (1, -2) is created.Point : (2, -1) is created.Point : (0, 0) is created.Point : (0, 0)=========================Point : (0, 0) is created.Point : (1, 1) is created.Line : (0, 0) to (1, 1) is created.Line : (0, 0) to (1, 1)Line : (0, 0) to (1, 1) is erased.Point : (1, 1) is erased.Point : (0, 0) is erased.=========================Point : (1, 1) is created.Point : (2, 3) is created.Line : (1, 1) to (2, 3) is created.Line : (1, 1) to (2, 3)Line : (1, 1) to (2, 3) is erased.Point : (2, 3) is erased.Point : (1, 1) is erased.=========================Point : (2, 3) is created.Point : (4, 5) is created.Line : (2, 3) to (4, 5) is created.Line : (2, 3) to (4, 5)Line : (2, 3) to (4, 5) is erased.Point : (4, 5) is erased.Point : (2, 3) is erased.=========================Point : (0, 1) is created.Point : (1, 0) is created.Line : (0, 1) to (1, 0) is created.Line : (0, 1) to (1, 0)Line : (0, 1) to (1, 0) is erased.Point : (1, 0) is erased.Point : (0, 1) is erased.=========================Point : (1, -2) is copied.Point : (2, -1) is copied.Line : (1, -2) to (2, -1) is created.Point : (1, -2) is copied.Point : (0, 0) is copied.Line : (1, -2) to (0, 0) is created.Point : (2, -1) i #include
using namespace std;
class Point
{
public:
double x1,y1;
public:
Point(double xx1 = 0,double yy1 = 0)
{
x1 = xx1;
y1 = yy1;
cout<>num;
for(i = 1; i <= num; i++)
{
std::cout<>x1>>c>>y1>>x2>>c>>y2;
Line line(x1, y1, x2, y2);
line.show();
}
std::cout<
입력한 첫 번째 비헤이비어 N은 다음에 N 행 테스트 예제가 있음을 나타냅니다.모든 행위의 두 그룹 좌표인'x, y'는 선의 시작점과 끝점을 나타내는 x 좌표와 y 좌표이고 두 그룹 좌표 사이는 하나의 빈칸으로 나누며 x와 y의 값은 모두 더블 데이터 범위 내에 있다.
Output
출력은 여러 줄로 되어 있고 행동마다 한 줄로 되어 있으며 시작점 좌표는 앞점 좌표가 뒤에 있고 각 점의 X 좌표는 앞에 있고 Y 좌표는 뒤에 있으며 Y 좌표 앞에는 빈칸을 하나 더 출력하여 괄호로 감싸고 있다.출력 형식은 Sample을 보십시오.
C 언어의 입력과 출력이 비활성화되었습니다.
Sample Input
40,0 1,11,1 2,32,3 4,50,1 1,0 Sample Output
Point : (1, -2) is created.Point : (2, -1) is created.Point : (0, 0) is created.Point : (0, 0)=========================Point : (0, 0) is created.Point : (1, 1) is created.Line : (0, 0) to (1, 1) is created.Line : (0, 0) to (1, 1)Line : (0, 0) to (1, 1) is erased.Point : (1, 1) is erased.Point : (0, 0) is erased.=========================Point : (1, 1) is created.Point : (2, 3) is created.Line : (1, 1) to (2, 3) is created.Line : (1, 1) to (2, 3)Line : (1, 1) to (2, 3) is erased.Point : (2, 3) is erased.Point : (1, 1) is erased.=========================Point : (2, 3) is created.Point : (4, 5) is created.Line : (2, 3) to (4, 5) is created.Line : (2, 3) to (4, 5)Line : (2, 3) to (4, 5) is erased.Point : (4, 5) is erased.Point : (2, 3) is erased.=========================Point : (0, 1) is created.Point : (1, 0) is created.Line : (0, 1) to (1, 0) is created.Line : (0, 1) to (1, 0)Line : (0, 1) to (1, 0) is erased.Point : (1, 0) is erased.Point : (0, 1) is erased.=========================Point : (1, -2) is copied.Point : (2, -1) is copied.Line : (1, -2) to (2, -1) is created.Point : (1, -2) is copied.Point : (0, 0) is copied.Line : (1, -2) to (0, 0) is created.Point : (2, -1) i #include
using namespace std;
class Point
{
public:
double x1,y1;
public:
Point(double xx1 = 0,double yy1 = 0)
{
x1 = xx1;
y1 = yy1;
cout<>num;
for(i = 1; i <= num; i++)
{
std::cout<>x1>>c>>y1>>x2>>c>>y2;
Line line(x1, y1, x2, y2);
line.show();
}
std::cout<
40,0 1,11,1 2,32,3 4,50,1 1,0 Sample Output
Point : (1, -2) is created.Point : (2, -1) is created.Point : (0, 0) is created.Point : (0, 0)=========================Point : (0, 0) is created.Point : (1, 1) is created.Line : (0, 0) to (1, 1) is created.Line : (0, 0) to (1, 1)Line : (0, 0) to (1, 1) is erased.Point : (1, 1) is erased.Point : (0, 0) is erased.=========================Point : (1, 1) is created.Point : (2, 3) is created.Line : (1, 1) to (2, 3) is created.Line : (1, 1) to (2, 3)Line : (1, 1) to (2, 3) is erased.Point : (2, 3) is erased.Point : (1, 1) is erased.=========================Point : (2, 3) is created.Point : (4, 5) is created.Line : (2, 3) to (4, 5) is created.Line : (2, 3) to (4, 5)Line : (2, 3) to (4, 5) is erased.Point : (4, 5) is erased.Point : (2, 3) is erased.=========================Point : (0, 1) is created.Point : (1, 0) is created.Line : (0, 1) to (1, 0) is created.Line : (0, 1) to (1, 0)Line : (0, 1) to (1, 0) is erased.Point : (1, 0) is erased.Point : (0, 1) is erased.=========================Point : (1, -2) is copied.Point : (2, -1) is copied.Line : (1, -2) to (2, -1) is created.Point : (1, -2) is copied.Point : (0, 0) is copied.Line : (1, -2) to (0, 0) is created.Point : (2, -1) i
#include
using namespace std;
class Point
{
public:
double x1,y1;
public:
Point(double xx1 = 0,double yy1 = 0)
{
x1 = xx1;
y1 = yy1;
cout<>num;
for(i = 1; i <= num; i++)
{
std::cout<>x1>>c>>y1>>x2>>c>>y2;
Line line(x1, y1, x2, y2);
line.show();
}
std::cout<