#include using namespace std; #define MAX 1024 struct ThongTin { int ngay, thang, nam; char sdt[15]; }; void Nhap(ThongTin tt[], int n) { for (int i = 0; i < n; i++) { scanf("%d %d %d %s", &tt[i].ngay, &tt[i].thang, &tt[i].nam, &tt[i].sdt); } } void Xuat(ThongTin tt[], int n) { for (int i = 0; i < n; i++) { cout << tt[i].ngay << " " << tt[i].thang << " " << tt[i].nam << " " << tt[i].sdt << endl; } } void Swap(int &a, int &b) { int temp = a; a = b; b = temp; } void Swap(ThongTin &a, ThongTin &b) { ThongTin temp = a; a = b; b = temp; } void QuickSort(ThongTin tt[], int a[], int left, int right) { int i, j, x; x = a[(left + right) / 2]; i = left; j = right; do{ while (a[i] < x) i++; while (a[j] > x) j--; if (i <= j) { Swap(a[i], a[j]); Swap(tt[i], tt[j]); i++; j--; } } while (i <= j); if (left> n; Nhap(tt, n); TinhNgaySinh(tt, a, n); QuickSort(tt, a, 0, n - 1); Xuat(tt, n); }