-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsdsdas.cpp
56 lines (54 loc) · 1.13 KB
/
sdsdas.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include<iostream>
using namespace std;
class SP{
public:
char *ten;
char *ID;
float thanhTien;
SP(char *ten,char *ID,float donGia,int soLuong){
this->ten = ten;
this->ID = ID;
this->soLuong = soLuong;
this->donGia = donGia;
}
SP(){};
~SP(){
delete[] ten;
delete[] ID;
this->soLuong = 0;
this->donGia = 0.0;
}
private:
float donGia;
int soLuong;
float tinhThanhTien(){
thanhTien = donGia*soLuong;
return thanhTien;
}
};
class HoaDon{
private:
char *tenKhachHang;
char *diaChi;
float tongTien(){
for(int i=0;i<soSanPham;i++){
tongtien += sanPham[i].thanhTien;
}
return tongtien;
}
public:
HoaDon(char* tenKhachhang,char* diaChi,SP *sanPham){
this->tenKhachHang = tenKhachHang;
this->diaChi = diaChi;
this->sanPham = sanPham;
};
HoaDon(){};
~HoaDon(){
delete[] tenKhachHang;
delete[] diaChi;
delete[] sanPham;
}
SP *sanPham = new SP[soSanPham];
static int soSanPham;
float tongtien;
};