Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабораторная работа 4 / l4bis / CLIENT
.CPP#ifndef CPP004
#define CPP004
#include "Client.h"
#include <string.h>
int Client::getreq()
{
return RequestNum;
}
Client::Client()
{
RequestNum=0;
}
Client::Client(char W[30])
{
strcpy(Name,W);
RequestNum = 0;
};
void Client::GetName(char N[30])
{
strcpy(N,Name);
}
void Client::Set(Client C)
{
char N[30];
C.GetName(N);
SetName(N);
RequestNum = C.getreq();
}
void Client::SetReq(int R)
{
RequestNum = R;
}
void Client::SetName(char N[30])
{
strcpy(Name,N);
}
void Client::getmsg(char M[100])
{
cout<<"Client "<<Name<<" incomming message: "<<endl
<<M<<endl;
SetReq(getreq() + 1);
}
int Client::sendrequest()
{
if (RequestNum > 0)
{
RequestNum -= 1;
return 1;
};
return 0;
}
Client::~Client(){};
#endif