Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://www.facebook.com/pages/C%C3%B9ng-h%E1%BB%8Dc-l%E1%BA%ADp-tr%C3%ACnh/632038696941833
- #include <iostream>
- #include <string>
- using namespace std;
- class NhanVien
- {
- protected:
- string HoTen, NgaySinh;
- int Luong;
- public:
- NhanVien(string HoTen = "", string NgaySinh = "")
- {
- this->HoTen = HoTen;
- this->NgaySinh = NgaySinh;
- }
- ~NhanVien(){};
- friend istream& operator >> (istream& in, NhanVien &NV)
- {
- fflush(stdin);
- cout << "Nhap ten: ";
- getline(in, NV.HoTen);
- cout << "Nhap ngay sinh: ";
- getline(in, NV.NgaySinh);
- return in;
- }
- friend ostream& operator << (ostream& out, NhanVien NV)
- {
- out << "Ten: " << NV.HoTen << "\nNgay sinh: " << NV.NgaySinh << endl;
- return out;
- }
- };
- class NVSanXuat : public NhanVien
- {
- public:
- NVSanXuat(string Ten = "", string NgaySinh = "", int LuongCanBan = 0, int SoSP = 0) : NhanVien(Ten, NgaySinh)
- {
- this->LuongCB = LuongCanBan;
- this->SoSP = SoSP;
- }
- ~NVSanXuat(){};
- int TinhLuong()
- {
- this->Luong = LuongCB + SoSP * 5000;
- return this->Luong;
- }
- friend istream& operator >> (istream& in, NVSanXuat &NV)
- {
- NhanVien *N = &NV;
- in >> *N;
- fflush(stdin);
- cout << "Nhap luong co ban: ";
- in >> NV.LuongCB;
- cout << "Nhap so SP: ";
- in >> NV.SoSP;
- return in;
- }
- friend ostream& operator << (ostream& out, NVSanXuat NV)
- {
- NhanVien *N = &NV;
- out << *N;
- out << "Luong co ban: " << NV.LuongCB << "\nSo san pham: " << NV.SoSP << "\nLuong: " << NV.TinhLuong() << endl;
- return out;
- }
- private:
- int LuongCB;
- int SoSP;
- };
- class NVVanPhong : public NhanVien
- {
- public:
- NVVanPhong(string Ten = "", string NgaySinh = "", int SoNgayLam = 0) : NhanVien(Ten, NgaySinh)
- {
- this->SoNgayLam = SoNgayLam;
- }
- ~NVVanPhong(){};
- int TinhLuong()
- {
- this->Luong = SoNgayLam * 100000;
- return this->Luong;
- }
- friend istream& operator >> (istream& in, NVVanPhong &NV)
- {
- NhanVien *N = &NV;
- in >> *N;
- fflush(stdin);
- cout << "Nhap so ngay lam: ";
- in >> NV.SoNgayLam;
- return in;
- }
- friend ostream& operator << (ostream& out, NVVanPhong NV)
- {
- NhanVien *N = &NV;
- out << *N;
- out << "So ngay lam: " << NV.SoNgayLam << "\nLuong: " << NV.TinhLuong() << endl;
- return out;
- }
- private:
- int SoNgayLam;
- };
- void main()
- {
- system("start https://www.facebook.com/pages/C%C3%B9ng-h%E1%BB%8Dc-l%E1%BA%ADp-tr%C3%ACnh/632038696941833");
- NVSanXuat a("nguyen huu tho", "11 07 96", 300000, 1000);
- cout << a;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement