Lập danh sách khen thưởng bằng oop

em có bài tập lớn về phần này, mà đề yêu cầu xuất danh sách khen thường và bộ phận trực thuộc, em mới chỉ làm được như này, ai giúp em gom nó lại làm một được không…

#include<iostream>
#include<string>
#define MAX 100
using namespace std;
class Person
{
public:
	void NhapP();
	void XuatP();
private:
	string name;
};
void Person::NhapP()
{
	fflush(stdin);
	cout<<"\nNhap Ho va Ten: ";
	getline(cin,name);

}	
void Person::XuatP()
{
	cout<<"\nHo va Ten: "<<name;
}
class GiangVien:public Person
{
public:
	void NhapGV();
	void XuatGV();
	int getSoCongTrinhNghienCuu();
private:
	int SoCongTrinhNghienCuu;
};
void GiangVien::NhapGV()
{
	Person::NhapP();
	cout<<"\nNhap So cong trinh nghien cuu";
	cin>>SoCongTrinhNghienCuu;
}
void GiangVien::XuatGV()
{
	Person::XuatP();
	cout<<"\nSo Cong Trinh Nghien Cuu: "<<SoCongTrinhNghienCuu;
}
int GiangVien::getSoCongTrinhNghienCuu()
{
	return SoCongTrinhNghienCuu;
}
class SinhVien:public Person
{
public:
	void NhapSV();
	void XuatSV();
	float getDiemTB();
private:
	float DiemTB;
};
void SinhVien::NhapSV()
{
	Person::NhapP();
	cout<<"\nNhap Diem TB:";cin>>DiemTB;
}
void SinhVien::XuatSV()
{
	Person::XuatP();
	cout<<"\nDiem TB :"<<DiemTB;
}
float SinhVien::getDiemTB()
{
	return DiemTB;
}
class NguoiQuanLy:public Person
{
public:
	void NhapNQL();
	void XuatNQL();
	int getHoanThanhCongViec();
private:
	int HoanThanhCongViec;
};
void NguoiQuanLy::NhapNQL()
{
	Person::NhapP();
	cout<<"Co hoan thanh cong viec duoc giao khong? nhap vao >= 2 neu hoan thanh, nhap <2 neu khong hoan thanh  ";
	cin>>HoanThanhCongViec;
}
void NguoiQuanLy::XuatNQL()
{
	Person::XuatP();
	cout<<"\nHoan Thanh cong viec duoc giao";
}
int NguoiQuanLy::getHoanThanhCongViec()
{
	return HoanThanhCongViec;
}
void MENU()
{
	GiangVien ArrGV[MAX];
	SinhVien ArrSV[MAX];
	NguoiQuanLy ArrNQL[MAX];
	int x,indexGV=0,indexSV=0,indexNQL=0;
	do
	{
		system("cls");
		cout<<"\n\t\t\t\t\t==============MENU===============";
		cout<<"\n\t\t\t\t\t1.Nhap vao Giang Vien.";
		cout<<"\n\t\t\t\t\t2.Nhap vao Sinh Vien.";
		cout<<"\n\t\t\t\t\t3.Nhap vao Nguoi Quan Ly.";
		cout<<"\n\t\t\t\t\t4.Xuat ra danh sach giang vien duoc khen thuong.";
		cout<<"\n\t\t\t\t\t5.Xuat ra danh sach sinh vien duoc khen thuong.";
		cout<<"\n\t\t\t\t\t6.Xuat ra danh sach nguoi quan ly duoc khen thuong.";
		cout<<"\n\t\t\t\t\t7.Thoat!";
		cout<<"\n\t\t\t\t\t Nhap vao lua chon cua ban?";
		cin>>x;
		switch (x)
		{
		case 1:
			{
				system("cls");
				int nGiangVien,dem=0;
				cout<<"\nSo giang vien can nhap.";
				cin>>nGiangVien;
				for(int i=indexGV;i<nGiangVien+indexGV;i++)
				{
					cout<<"\nGiang Vien "<<i+1<<":\n";
					ArrGV[i].NhapGV();
					dem++;
				}
				indexGV+=dem;
				cout<<"\nDa nhap xong!";
				system("pause");
			}
			break;
		case 2:
			{
				system("cls");
				int nSinhVien,dem=0;
				cout<<"\nSo sinh vien can nhap.";
				cin>>nSinhVien;
				for(int i=indexSV;i<nSinhVien+indexSV;i++)
				{
					cout<<"\nSinh Vien "<<i+1<<":\n";
					ArrSV[i].NhapSV();
					dem++;
				}
				indexSV+=dem;
				cout<<"\nDa nhap xong!";
				system("pause");
			}
			break;
		case 3:
			{
				system("cls");
				int nNguoiQuanLy,dem=0;
				cout<<"\nSo Nguoi quan ly can nhap:";
				cin>>nNguoiQuanLy;
				for(int i=indexNQL;i<nNguoiQuanLy+indexNQL;i++)
				{
					cout<<"\n Nguoi Quan Ly"<<i+1<<":\n";
					ArrNQL[i].NhapNQL();
					dem++;
				}
				indexNQL+=dem;
				cout<<"\nDa nhap xong!";
				system("pause");
			}	
			break;
		case 4:
			{
				int j=1;
				system("cls");
				cout<<"\nDanh sach giang vien duoc khen thuong la.\n";
				for(int i=0;i<indexGV;i++)
				{
					if(ArrGV[i].getSoCongTrinhNghienCuu()>=2)
					{
						cout<<"\nGiang vien thu "<<j<<":";
						ArrGV[i].XuatGV();cout<<endl;
						j++;
					}
				}
				system("pause");
			}
			break;
		case 5:
			{
				int j=1;
				system("cls");
				cout<<"\nDanh sach sinh vien duoc khen thuong la.\n";
				for(int i=0;i<indexSV;i++)
				{
					if(ArrSV[i].getDiemTB()>8)
					{
						cout<<"\nSinh vien thu "<<j<<":";
						ArrSV[i].XuatSV();cout<<endl;
						j++;
					}
				}
				system("pause");
			}
			break;
		case 6:
			{
				int j=1;
				system("cls");
				cout<<"Danh sach nguoi quan ly duoc khen thuong la:\n";
				for(int i=0;i<indexNQL;i++)
				{
					if(ArrNQL[i].getHoanThanhCongViec()>=2)
					{
						cout<<"\n Nguoi Quan ly thu"<<j<<":";
						ArrNQL[i].XuatNQL();
						cout<<endl;
						j++;
					}
				}
				system("pause");
			}
			break;
		default:
			break;
		}
	}
	while(x!=7);
}
int main()
{
	MENU();
	system("pause");
	return 0;
}

Format code bạn ơi, cho code của bạn vào 2 dấu ```
https://daynhauhoc.com/t/cach-post-code-dung-markdown-trong-category-programming/112

2 Likes
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?