CopyCodeThiTuiSeHoiThamMomo

 avatar
NguyenAnhQuan
c_cpp
2 months ago
837 B
2
Indexable
Never
#include <iostream>

using namespace std;

struct NhanVien
{
	string MaNhanVien;
	string HoVaTen;
	string PhongBan;

	int LuongCoBan;
	int Thuong;
	int ThucLanh;
};

int n;
NhanVien* NV;

void Input()
{
	cin >> n;

	NV = new NhanVien[n + 1];

	for (int i = 0; i < n; i++)
	{
		cin.ignore();
		getline(cin, (NV + i) ->MaNhanVien);
		getline(cin, (NV + i) ->HoVaTen);
		getline(cin, (NV + i) ->PhongBan);

		cin >> (NV + i) ->LuongCoBan;
		cin >> (NV + i) ->Thuong;
	}
}

void TinhThucLanh()
{
	cout << "Thuc lanh cua " << n << " nhan vien : \n";

	for (int i = 0; i < n; i++)
	{
		(NV + i) ->ThucLanh = (NV + i) ->LuongCoBan + (NV + i) -> Thuong;
		cout << (NV + i) ->HoVaTen << " : " << (NV + i) ->ThucLanh << "\n";
	}
}

int main(){

	Input();
	TinhThucLanh();





	return 0;	
}
Leave a Comment