Phan main - Danh sach lien ket
#include "khaiBao.h"
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
using namespace std;
int main()
{ DSLKD dau, cuoi, dau1, cuoi1, dau2, cuoi2, hop, hieu, giao;
kieuDL d;
//Tao Danh sach lien ket don.
taoDSLKD(dau, cuoi);
cout<<"Danh sach lien ket moi tao ra la: "<<endl;
duyetDSLKD(dau);
cout<<endl;
daoDSLKD(dau,cuoi);
cout<<"Danh sach lien ket sau khi dao la: "<<endl;
duyetDSLKD(dau);
cout<<endl;
xoaNutTrung(dau,cuoi);
cout<<"Danh sach lien ket sau khi xoa nut trung la: "<<endl;
duyetDSLKD(dau);
cout<<endl;
//Tao Danh sach lien ket don gom n phan tu sinh so ngau nhien.
taoDSLKDN(dau, cuoi);
duyetDSLKD(dau);
cout<<endl;
//Tim phan tu trong DSLKD.
timD(dau, d);
cout<<endl<<endl;
cout<<"Nhap tap hop A:
";
taoDSLKD(dau1,cuoi1);
cout<<"Nhap tap hop B:
";
taoDSLKD(dau2,cuoi2);
cout<<"Tap hop A vua tao la: ";
cout<<"A= {";duyetTapHop(dau1);
cout<<"}"<<endl;
cout<<"
Tap hop B vua tao la: ";
cout<<"B={";duyetTapHop(dau2);
cout<<"}"<<endl;
hop2TapHop(dau1,dau2);
giao2TapHop(dau1,dau2);
cout<<"
Hieu cua hai tap A va B la: A/B = {";
hieu2TapHop(dau1,dau2);
cout<<"}"<<endl;
cout<<"
Hieu cua hai tap B va A la: B/A = {";
hieu2TapHop(dau2,dau1);
cout<<"}"<<endl<<endl;
if (kiemTraTapCon(dau1,dau2)==1)
cout<<"A khong phai tap con cua B."<<endl<<endl;
else cout<<"A la tap con cua B."<<endl<<endl;
if (kiemTraTapCon(dau2,dau1)==1)
cout<<"B khong phai tap con cua A."<<endl<<endl;
else cout<<"B la tap con cua A."<<endl<<endl;
getch();
//Giai phong.
giaiPhong(dau1,cuoi1);
return 0;
}
Bạn đang đọc truyện trên: AzTruyen.Top