Nội dung code BFS kỹ thuật lập trình

4 294 1
Nội dung code BFS  kỹ thuật lập trình

Đang tải... (xem toàn văn)

Thông tin tài liệu

CODE 011010 100110 100100 011001 110000 000100 Trích dẫn: Trích dẫn: #include #include #include #include #define MAX 20 int X[20]={100,200,200,300,300,400,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; int Y[20]={200,300,100,100,300,200,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; struct Node { char TenNode[20]; int x,y,R; int color; int bgcolor; }; void drawnode (Node x) { setcolor (x.color); setfillstyle(SOLID_FILL, x.bgcolor); // circle (x.x,x.y,x.R); fillellipse (x.x,x.y,x.R, x.R); outtextxy(x.x+5,x.y-3*x.R, x.TenNode); } void drawline (Node u, Node v) { line (u.x,u.y,v.x,v.y); }; /*Dinh nghia cac tap diem truoc, sau khai bao mang x,y*/ //Viet ham khoi tao dinh void khoitaotoado (Node a[],int n) { for (int k=0; k { a[k].x=X[k]; a[k].y=Y[k]; a[k].R=9; sprintf(a[k].TenNode,"%d",k+1); /* if(k) { a[k].color=k; a[k].bgcolor=k; } else { */ a[k].color=9; a[k].bgcolor=9; // } } } //Ve cung, chua ve dinh void vedothi (Node a[],int n,int edge[MAX][MAX]) { for (int i=0;i

Ngày đăng: 04/05/2016, 00:31

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan