9. Tester.Cpp
#include "l1c1point.cpp"
#include "l1c2trgl.cpp"
#include "l1c4list.cpp"
class ic
{
int I;
public:
int Get(){return I;};
void Set(ic K){I=K.Get();};
void SetI(int K){I=K;};
void Out(){cout<<I<<" ";};
};
void main()
{
clrscr();
cout<<"Program for test clases"<<endl<<endl;
cout<<".................................."<<endl;
cout<<"class Point:"<<endl<<endl;
getch();
cPoint P(5,6);
cout<<"Point (5;6) ";
P.Out();
cout<<endl;
getch();
P.Move(2,-4);
cout<<"move dx=2 dy=-4 ";
P.Out();
cout<<endl;
getch();
P.Rotate(1,0,3.1415927);
cout<<"rotate ((1;0);Pi) ";
P.Out();
cout<<endl;
getch();
P.Mirror(3,0);
cout<<"Mirror. Center:(3;0) ";
P.Out();
cout<<endl;
cout<<".................................."<<endl;
getch();
cout<<endl<<"classes list element and list"<<endl;
List<ic> L;
ic K;
cout<<" " ;
L.out();
cout<<endl;
getch();
K.SetI(1);
L.add(K);
cout<<"add 1 to list ";
L.GetInf(K);
K.Out();
cout<<" " ;
L.out();
K.SetI(2);
L.add(K);
cout<<endl;
cout<<"add 2 to list ";
L.GetInf(K);
K.Out();
cout<<" " ;
L.out();
cout<<endl;
K.SetI(3);
L.add(K);
cout<<"add 3 to list ";
L.GetInf(K);
K.Out();
cout<<" " ;
L.out();
cout<<endl;
getch();
L.move();
cout<<"Go to the next ";
L.GetInf(K);
K.Out();
cout<<" " ;
L.out();
cout<<endl;
L.move();
cout<<"Go to the next ";
L.GetInf(K);
K.Out();
cout<<" " ;
L.out();
cout<<endl;
getch();
L.del();
cout<<"delete cur element ";
L.GetInf(K);
K.Out();
cout<<" " ;
L.out();
cout<<endl;
getch();
L.move();
cout<<"Go to the next ";
L.GetInf(K);
K.Out();
cout<<" " ;
L.out();
cout<<endl;
L.move();
cout<<"Go to the next ";
L.GetInf(K);
K.Out();
cout<<" " ;
L.out();
cout<<endl;
getch();
L.del();
cout<<"delete cur element ";
L.GetInf(K);
K.Out();
cout<<" " ;
L.out();
cout<<endl;
getch();
L.del();
cout<<"delete cur element ";
cout<<" " ;
L.out();
cout<<endl;
cout<<".................................."<<endl
<<endl;
getch();
cout<<"class Triangle"<<endl<<endl;
cPoint P1(2,0), P2(4,0), P3(3,5);
cTriangle T(P1,P2,P3);
T.Out();
getch();
T.move(-1,2);
cout<<"move dx=-1 dy=2 ";
T.Out();
getch();
T.rotate(0,4,1.5707964);
cout<<"rotate ((0;4);Pi/2) ";
T.Out();
getch();
T.scale(3);
cout<<"scale. coefficient 3 ";
T.Out();
cout<<".................................."<<endl;
getch();
};
Вывод.
Разработана программа, отвечающая заданию и корректная с точностью до всех проведенных тестов.