Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабораторная работа 33 / LAB 3 / CTABLET
.CPP//File ‘CTablet.cpp'
//Naznachenie: Opredelenie funkcij klassa ?Planshet?
//Author Pavel Morozov
//Red: 1.0 6.05.07
#ifndef Ctablet_cpp
#define Ctablet_cpp
#include<iostream.h>
#include<math.h>
#include<conio.h>
#include<stdio.h>
#include"Ctablet.h"
#include"cpoint.h"
#include"cpoint.cpp"
//------------------Konstruktor Klassa CPlanshet---------------------------
CPlanshet:: CPlanshet (CPoint A0,CPoint B0,CPoint C0,CPoint D0
) //Pervyj konstruktor
: A(A0),B(B0),C(C0),D(D0) //Spisok inicializacij
{
float x,y;
textcolor(9);
cout<<endl;
cprintf("Konstruktor CPlanshet sozdal ekzempliar klassa");
cout<<endl;
cprintf("S nulevymi atributami" );
cout<<endl;
A0.GetX(x,y);
cprintf("Posle raboty konstruktora CPlanshet: A.x = ");
cout<<x;
cprintf(", A.y = ");
cout<<y
<<endl;
B0.GetX(x,y);
cprintf(", B.x = ");
cout<<x;
cprintf(", B.y = ");
cout<<y;
C0.GetX(x,y);
cprintf(", C.x = ");
cout<<x;
cprintf(", C.y = ");
cout<<y;
D0.GetX(x,y);
cprintf(", D.x = ");
cout<<x;
cprintf(", D.y = ");
cout<<y;
cout<<endl;
textcolor(15);
// A=A0;B=B0;C=C0;D=D0;
}
//-----------------Funkcii interfejsa----------------------------
void CPlanshet::SetFigureXY( float Ax0, float Ay0,
float Bx0, float By0,
float Cx0, float Cy0,
float Dx0, float Dy0)
//zadanie atributov plansheta
{
A.SetX(Ax0,Ay0);
B.SetX(Bx0,By0);
C.SetX(Cx0,Cy0);
D.SetX(Dx0,Dy0);
}
void CPlanshet::GetFigureXY( float &Ax0, float &Ay0,
float &Bx0, float &By0,
float &Cx0, float &Cy0,
float &Dx0, float &Dy0)
//Poluchenie plansheta
{
A.GetX(Ax0,Ay0);
B.GetX(Bx0,By0);
C.GetX(Cx0,Cy0);
D.GetX(Dx0,Dy0);
}
void CPlanshet::MoveFigure(float dx,float dy)
// peremeshenie plansheta na dx i dy
{
A.MovePoint(dx,dy);
B.MovePoint(dx,dy);
C.MovePoint(dx,dy);
D.MovePoint(dx,dy);
}
void CPlanshet::OutList()
{
float x0,y0,x2,y2,x3,y3,dx,dy;
GetFigureXY(x0,y0,x2,y2,x3,y3,dx,dy);
cout<<endl<<"Vyvod na ekran koordinat tochek plansheta";
cout<<endl<<"A.x= "<<x0<<", A.y= "<<y0<<endl;
cout<<endl<<"B.x= "<<x2<<", B.y= "<<y2<<endl;
cout<<endl<<"C.x= "<<x3<<", C.y= "<<y3<<endl;
cout<<endl<<"D.x= "<<dx<<", D.y= "<<dy<<endl;
}
//-----------------------Destruktor------------------------------
CPlanshet::~CPlanshet()
{
float x,y;
textcolor(10);
cout<<endl
<<endl;
A.GetX(x,y);
cprintf("~CPlanshet: razrushaetsia figura s atributami A.x= ");
cout<<x;
cprintf(", A.y = ");
cout<<y
<<endl;
B.GetX(x,y);
cprintf(", B.x = ");
cout<<x;
cprintf(", B.y = ");
cout<<y;
C.GetX(x,y);
cprintf(", C.x = ");
cout<<x;
cprintf(", C.y = ");
cout<<y;
D.GetX(x,y);
cprintf(", D.x = ");
cout<<x;
cprintf(", D.y = ");
cout<<y;
cout<<endl;
textcolor(15);;
cprintf("Objekt unichtozen...");
cout<<endl;
cprintf("Nazmite probel...");
cout<<endl<<endl;
getch();
textcolor(15);
}
#endif
Соседние файлы в папке LAB 3