#include<iostream>
#include<math.h>
#include<conio.h>
using namespace std;
#define MAXLIST 100;
const int KTDS=100;
typedef char DATATYPE;
struct taixe
{
char MTX[10];
char HOTEN[30];
int NGAY,THANG,NAM;
char LOAIXEHOPDONG;
};
struct DSTX
{
int sotaixe;
taixe TX[KTDS];
};
struct khachhang
{
char MAKH[10];
char HOTEN[30];
char SDT[15];
int NGAY, GIO, KMDADI;
};
struct DSKH
{
int sokhachhang;
khachhang dsKH[KTDS];
};
void initialize(DSTX &ds)
{
ds.sotaixe=0;
}
void nhap1taixe(taixe &tx)
{
cout<<"
Nhap ma tai xe: ";
cin>>tx.MTX;
cout<<"
Nhap ho ten tai xe: ";
cin>>tx.HOTEN;
/*cin.getline(tx.HOTEN,30);*/
cout<<"
Nhap ngay hop dong: ";
cin>>tx.NGAY;
cout<<"
Nhap thang hop dong: ";
cin>>tx.THANG;
cout<<"
Nhap nam hop dong: ";
cin>>tx.NAM;
cout<<"
Nhap loai xe: ";
cin>>tx.LOAIXEHOPDONG;
}
void xuat1taixe(taixe tx)
{
cout<<"
ma tai xe: ";
cout<<tx.MTX;
cout<<"
ho ten tai xe: ";
cout<<tx.HOTEN;
cout<<"
ngay hop dong: ";
cout<<tx.NGAY<<"/"<<tx.THANG<<"/"<<tx.NAM;
cout<<"
loai xe: ";
cout<<tx.LOAIXEHOPDONG;
}
void nhapDSTX(DSTX &ds)
{
int i;
cout<<"
Nhap so tai xe: ";
cin>>ds.sotaixe;
for( i=0; i<ds.sotaixe; i++)
{
cout<<"
Nhap so phan tu thu: "<<i<<" :";
nhap1taixe(ds.TX[i]);
}

}
void xuatDSTX(DSTX ds)
{
for(int i=0;i<ds.sotaixe;i++)
{ cout<<"
Tai xe thu "<<i<<" :";
xuat1taixe(ds.TX[i]);
}
}
void nhap1khachhang(khachhang &kh)
{
cout<<"
Nhap ma khach hang: ";
cin>>kh.MAKH;
cout<<"
Nhap ho ten khach hang: ";
cin.getline(kh.HOTEN, 30);
cout<<"
Nhap so dien thoai lien lac: ";
cin>>kh.SDT;
cout<<"
Nhap ngay di: ";
cin>>kh.NGAY;
cout<<"
Nhap gio di: ";
cin>>kh.GIO;
cout<<"
Nhap so km da di: ";
cin>>kh.KMDADI;
}
void xuat1khachhang(khachhang kh)
{
cout<<"
Ma khach hang: ";
cout<<kh.MAKH;
cout<<"
Ho ten khach hang: ";
cout<<kh.HOTEN;
cout<<"
So dien thoai hang:";
cout<<kh.SDT;
cout<<"
Ngay di ";
cout<<kh.NGAY;
cout<<" Gio di";
cout<<kh.GIO;
cout<<"
So km da di: ";
cout<<kh.KMDADI;
}
void nhapDSKH(DSKH &ds)
{
int i;
cout<<"
Nhap so khach hang: ";
cin>>ds.sokhachhang;
for(int i=0; i<ds.sokhachhang; i++)
{
cout<<"
Nhap so phan tu thu: "<<i<<" :";
nhap1khachhang(ds.dsKH[i]);
}

}
void xuaDSKH(DSKH ds)
{
for(int i=0;i<ds.sokhachhang;i++)
{
cout<<"
Khach hang thu"<<i<<":";
xuat1khachhang(ds.dsKH[i]);
}
}
int Timkiem_taixe(DSTX x, int mstim)
{
for(int i=0;i<x.sotaixe;i++)
if(mstim==x.TX[i].ms)
return i;
return -1;
}
void timkiemnhap1taixe(taixe &x)
{ DSTX;
int msxx;int xa;
cout<<"
Nhap mstx :";
cin>>x.MTX;
cout<<"
Nhap danh sach cac phan tu VIDEO cua DIEN VIEN :";
for(int i=0;i<x.MTX.sotaixe;i++)
{
do{
cout<<"
Nhap ma so cua VIDEO :";
cin>>msxx;
xa=Timkiem_taixe(DSTX ,msxx);
if(xa!=-1)
{
x.MTX.tx[KTDS]=DSVideo.Data[xa];
break;
}

}while(1);
}
}
void main()
{
int x;
DSTX ds;
initialize(ds);
nhapDSTX(ds);
xuatDSTX(ds);
cout<<"
Danh sach vua nhap la: ";
system("pause");
}