- FB : https://www.facebook.com/nk4n01 - Fage : https://www.facebook.com/tlsvchuoi - Group : https://www.facebook.com/groups/188033564867521 - SĐT : 01682 456 866
Trang 1#include <iostream>
#include <string>
using namespace std;
class KhachHang
{
public:
void NhapDL()
{
cout << "Nhap ho ten: ";cin>>HoTen;
cin.getline(HoTen,255);
cout << "Nhap so nha: ";
cin.getline(SoNha,255);
cout << "Nhap ma so cong to: ";
cin.getline(MaSo,255);
cout << endl;
}
void InDL()
{
cout << "Ho ten khach hang: " << HoTen << endl; cout << "So nha: " << SoNha << endl;
cout << "Ma so cong to: " << MaSo << endl; }
private:
char HoTen[255], SoNha[255], MaSo[255];
};
class BienLai
{
public:
void NhapCS()
{
cout << "Nhap chi so cu: ";
cin >> Csc;
cout << "Nhap chi so moi: ";
cin >> Csm;
Tien = (Csc*Csm)*850000;
}
void InCS()
{
cout << "Chi so cu: " << Csc << endl;
cout << "Chi so moi: " << Csm << endl;
cout << "Thanh tien: " << Tien << endl;
}
private:
int Csc, Csm, Tien;
};
int main()
Trang 2int n, i;
char tem[255];
KhachHang KH[255];
BienLai CS[255];
cout << "Nhap so luong khach hang: ";
cin >> n;
cout << endl;
for (i=0;i<n;i++)
{
cout << "Khach hang thu " << i+1 << "!" << endl; KH[i].NhapDL();
CS[i].NhapCS();
}
tem[0]='y';
while (tem[0]=='Y'||tem[0]=='y')
{
system("pause");
system("cls");
cout << "Nhap ma so cong to thanh toan: ";
cin.getline(tem,255);
cout << "Nhap Y de tiep tuc chuong trinh.";
cin.getline(tem,0);
}
return 0;
}