7. Msg.H
#ifndef H012
#define H012
class msg
{
char action[100];
double X1,X2,X3;
public:
msg(char a[100], double NX1, double NX2, double NX3);
msg(char a[100], double NX1, double NX2);
msg(char a[100], double NX1);
msg(char a[100]);
msg();
void SetAct(char a[100]);
void SetX1(double NX1);
void SetX2(double NX2);
void SetX3(double NX3);
void Set(msg P);
void GetAct(char a[100]);
double GetX1();
double GetX2();
double GetX3();
~msg();
};
#endif
8. Msg.Cpp
#ifndef CPP012
#define CPP012
#include "msg.h"
#include <string.h>
msg::msg(char a[100] , double NX1, double NX2,double NX3)
{
strcpy(action , a);
X1 = NX1;
X2 = NX2;
X3 = NX3;
}
msg::msg(char a[100] , double NX1, double NX2)
{
strcpy(action , a);
X1 = NX1;
X2 = NX2;
X3 = 0;
}
msg::msg(char a[100] , double NX1)
{
strcpy(action , a);
X1 = NX1;
X2 = 0;
X3 = 0;
}
msg::msg(char a[100])
{
strcpy(action , a);
X1 = 0;
X2 = 0;
X3 = 0;
}
msg::msg()
{
strcpy(action , "MOVE");
X1 = 0;
X2 = 0;
X3 = 0;
}
void msg::SetAct(char a[100])
{
strcpy(action , a);
}
void msg::SetX1(double NX1)
{
X1 = NX1;
}
void msg::SetX2(double NX2)
{
X2 = NX2;
}
void msg::SetX3(double NX3)
{
X3 = NX3;
}
void msg::GetAct(char a[100])
{
strcpy(a,action);
}
double msg::GetX1()
{
return X1;
}
double msg::GetX2()
{
return X2;
}
double msg::GetX3()
{
return X3;
}
void msg::Set(msg P)
{
char a[100];
P.GetAct(a);
SetAct(a);
SetX1(P.GetX1());
SetX2(P.GetX2());
SetX3(P.GetX3());
}
msg::~msg(){}
#endif
9. Kutest.Cpp
#include "Server.cpp"
void main()
{
clrscr();
Server S;
cPoint P1(8,1),P2(-8,1),P3(0,2),P4(1,0),P5(3,0),P6(2,1);
cColTriangle T1,T2(P1,P2,P3),T3(P4,P5,P6);
msg M1("SCALE",2),M2("CHCOLG"),M3("MOVE",0,1),M4("ROTATE",0,6,3.14159),M5("Hello!");
S.SetBoard(0,0,10);
cout<<
endl<<endl<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl
<<"Add 2 triangles by arguments and 1 by default"<<endl
<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl;
S.addClient("tria1",T2);
S.addClient("tria2",T1);
S.addClient("tria3",T3);
S.SystemInfo();
S.workaccount();
cout<<
endl<<endl<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl
<<"Send broadcast move(0,1) command"<<endl
<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl;
S.broadcastmsg(M3);
S.SystemInfo();
S.workaccount();
cout<<
endl<<endl<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl
<<"Send rotate((0;6);Pi) message to client tria1,"<<endl
<<" text message & change color message to tria2 "<<endl
<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl;
S.personalmsg("tria1",M4);
S.personalmsg("tria2",M5);
S.personalmsg("tria2",M2);
S.SystemInfo();
S.workaccount();
cout<<
endl<<endl<<"~~~~~~~~~~~~~~~~~~~~~"<<endl
<<"Get delivery requests"<<endl
<<"~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl;
S.requestcheck();
S.SystemInfo();
S.workaccount();
cout<<
endl<<endl<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl
<<"Change Board coordinates to ((2;1);1.5)"<<endl
<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl;
S.SetBoard(2,1,1.5);
S.SystemInfo();
S.workaccount();
cout<<
endl<<endl<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl
<<"delete client tria3 by name"<<endl
<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl;
S.delClient("tria3");
S.SystemInfo();
S.workaccount();
}
Вывод.
Разработана программа, отвечающая заданию и корректная с точностью до всех проведенных тестов.