Object Oriented Programming - 30


while((q!=NULL)&&(strcmp((q->info).getid(),x)!=0)) q=q->link;

if(q!=NULL)

{

p=q->link; remove(q);

Maybe you are interested!

}

else p=NULL;

Object Oriented Programming - 30

}

}

};

//invoice list class

class hdlist:public list<hoadon>

{

private: node<hoadon> *home;

public:

long tk_nv(char *ma)

{

node<hoadon> *p; long total=0; p=home; while(p!=NULL)

{

if(strcmp((p->info).getmanv(),ma)==0) total+=(p->info).getgia();

p=p->link;

}

return total;

}

long tk_kh(char *ma)

{

node<hoadon> *p; long total=0; p=home; while(p!=NULL)

{

if(strcmp((p->info).getmakh(),ma)==0) total+=(p->info).getgia();

p=p->link;

}

return total;

}

long tk_mh(char *ma)

{

node<hoadon> *p; long total=0;


p=home; while(p!=NULL)

{

if(strcmp((p->info).getmamh(),ma)==0) total+=(p->info).getgia();

p=p->link;

}

return total;

}

};

//main program

void main()

{

int choose; do

{

clrscr();

cout<<"n 1. Manage room list"; cout<<"n 2. Manage manager list"; cout<<"n 3. Manage employee list"; cout<<"n 4. Manage item list"; cout<<"n 5. Manage customer list"; cout<<"n 6. Manage invoice";

cout<<"n 7. Manage supplier list"; cout<<"n 8. End program"; cout<<"nSelect function:";cin>>select;

switch

{

case 1: char lc,tl;

list<phong> l; do

{


book:";

clrscr();

cout<<"na. Show room list"; cout<<"nb. Search";

cout<<"nc. Add room to list"; cout<<"nd. Remove room from list


cout<<"ne. Room number statistics"; cout<<"nf. Room leader search"; cout<<"ng. Return(receive r):"; cout<<"n Select:";cin.ignore(); cin>>lc;

switch(lc)

{

case 'a':



sung";


wind";

l.doc_tep("style.txt"); l.display();

getch(); break; case 'b':

char ma[5]; cout<<"Ma Phong:"; cin.ignore(); cin.getline(ma,5); l.find_tt(ma); getch();

break; case 'c': room x; clrscr();

cout<<"Enter information about the room


cin>>x; l.add(x);

l.record_bs("phong.txt",x); break;

case 'd': cout<<"Ma Phong:"; cin.getline(ma,5); l.remove(ghost);

l.record_tep("room.txt"); break;

case 'e':

cout<<"All of "<<l.count()<<"


getch(); break; case 'f':

list<nguoiquanly> ql; ql.doc_tep("nguoiql.txt"); cout<<"Ma Phong:"; cin.getline(ma,5); ql.find_tt(ma);

getch(); break;

}

}

while(lc!='r'); break;

case 2: list<peoplequanly> ql; ql.doc_tep("nguoiql.txt");


by

{

clrscr();

cout<<"na. Show list of administrators"; cout<<"nb. Search";

cout<<"nc. Add manager to list"; cout<<"nd. Remove manager from list:"; cout<<"ne. Statistics of number of managers"; cout<<"nf. Find room";

cout<<"ng. Go back(receive):"; cout<<"n You choose:";

cin>>lc; switch(lc)


sung";


glass";

{

case 'a':

ql.display();

getch(); break; case 'b':

char ma[5];

cout<<"Administrator code:"; cin.ignore(); cin.getline(code,5); ql.find_tt(code);

getch(); break; case 'c':

administrator x; clrscr();

cout<<"Enter information about the person


cin>>x; ql.add(x);

ql.ghi_bs("nguoiql.txt",x); break;

case 'd':

cout<<"Administrator code:"; cin.getline(code,5); ql.remove(code); ql.ghi_tep("user.txt"); break;

case 'e':

cout<<"All "<<ql.count()<<" people are present


getch(); break; case 'f':


list<room> l; l.doc_tep("style.txt"); cout<<"Ma Phong:"; cin.getline(ma,5); l.find_tt(ma);

getch(); break;

}

}

while(lc!='r'); break;

case 3:

list<employee> nvl; nvl.doc_tep("employee.txt");

by

{

clrscr();

cout<<"na. Show list of employees"; cout<<"nb. Search";

cout<<"nc. Add employee to list"; cout<<"nd. Remove employee from list:"; cout<<"ne. Employee number statistics"; cout<<"nf. Find room";

cout<<"ng. Go back(receive):"; cout<<"n You choose:";

cin>>lc;

switch(lc)

{

case 'a': nvl.display(); getch(); break;

case 'b': char ma[5];

cout<<"Number:"; cin.ignore(); cin.getline(ma,5); nvl.find_tt(ma); getch();

break; case 'c': employee x; clrscr();

cout<<"Enter information about the person

sung";


cin>>x; nvl.add(x);



pill";

nvl.ghi_bs("employee.txt",x); break;

case 'd':

cout<<"Employee code:"; cin.getline(code,5); nvl.remove(code); nvl.ghi_tep("employee.txt"); break;

case 'e':

cout<<"Get all "<<nvl.count()<<"


getch(); break; case 'f':

list<room> l; l.doc_tep("style.txt"); cout<<"Ma Phong:"; cin.getline(ma,5); l.find_tt(ma);

getch(); break;

}

}

while(lc!='r'); break;

case 4:

list<mathang> mhl; mhl.doc_tep("mathang.txt");

by

{

clrscr();

cout<<"na. Show item list"; cout<<"nb. Search";

cout<<"nc. Add item to list"; cout<<"nd. Remove item from list:"; cout<<"ne. Item number statistics"; cout<<"nf. Find supplier";

cout<<"ng. Go back(receive):"; cout<<"n You choose:";

cin>>lc;

switch(lc)

{

case 'a': mhl.display(); getch(); break;

case 'b':



sung";


cave";

char ma[5];

cout<<"Ghost number:"; cin.ignore(); cin.getline(ma,5); mhl.find_tt(ma); getch();

break; case 'c': mathang x; clrscr();

cout<<"Enter information about the item


cin>>x; mhl.add(x);

mhl.ghi_bs("mathang.txt",x); break;

case 'd':

cout<<"Ghost number:"; cin.getline(ma,5); mhl.remove(ghost); mhl.ghi_tep("mathang.txt"); break;

case 'e':

cout<<"All of "<<mhl.count()<<" mat


getch(); break; case 'f':

list<nhacungcap> l; l.doc_tep("nhacc.txt"); cout<<"The house provides:"; cin.getline(ma,5); l.find_tt(ma);

getch(); break;

}

}

while(lc!='r'); break;

case 5:

list<khachhang> khl; khl.doc_tep("khhang.txt");

by

{


cave";

clrscr();

cout<<"na. Show guest list


cout<<"nb. Search";

cout<<"nc. Add customer to list"; cout<<"nd. Remove customer from list:"; cout<<"ne. Customer number statistics"; cout<<"nf. Return(receive):";

cout<<"n Select:"; cin>>lc;

switch(lc)

{

case 'a': khl.display(); getch(); break;

case 'b': char ma[5];

cout<<"Customer code:"; cin.ignore(); cin.getline(ma,5); khl.find_tt(ghost); getch();

break; case 'c':

customer x; clrscr();

cout<<"Enter customer information

sung";


cave";


cin>>x; khl.add(x);

khl.ghi_bs("khhang.txt",x); break;

case 'd':

cout<<"Customer code:"; cin.getline(ma,5); khl.remove(ghost); khl.ghi_tep("khhang.txt"); break;

case 'e':

cout<<"All "<<khl.count()<<" guests


getch(); break;

}

}

while(lc!='r'); break;

case 6:

hdlist hdl;

Comment


Agree Privacy Policy *