1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#include <iostream>
#include <list>
#include <algorithm>
#include <string>
#define MAX_W 100
using namespace std;
double rm=3534.54, rh=3854.67;
struct sWorker
{
string Name;
int Id;
double Avr_sal;
};
sWorker *Pers_c(string inName, int inId, double inAvr_sal)
{
sWorker *p=new sWorker;
p->Name=inName;
p->Id=inId;
p->Avr_sal=inAvr_sal;
return p;
}
void Pers_d(sWorker *p)
{
delete p;
}
int main()
{
sWorker *Kr_T, *Dj_I, *Py_P, *Ku_I;
list<sWorker*> wol;
list<sWorker*>::iterator pw;
wol.push_back(Kr_T=Pers_c("Krav Tar",'F',rm));
wol.push_back(Dj_I=Pers_c("Djm Iv",'H',rh));
wol.push_back(Py_P=Pers_c("Pyh Pav",'F',rm));
wol.push_back(Ku_I=Pers_c("Kup Iv",'H',rh));
for(pw=wol.begin(); pw!=wol.end(); pw++)
{
cout<<*pw<<endl;
}
Pers_d(Kr_T);
Pers_d(Dj_I);
Pers_d(Py_P);
Pers_d(Ku_I);
return 0;
}
| |