编辑: ZCYTheFirst 2019-07-09

//指向顾客链表 while(h) { if(fwrite(h,sizeof(cnode),1,fp)==1) h=h->

next;

} p=p->

next;

} fclose(fp);

} //打开保存的文件 void openFile(Linklist L) { FILE *fp1,*fp2;

Linklist q,p=L;

link h1,h2;

//打开航班文件创建航班链表 if((fp1=fopen( f:\\Hangban.txt , rb+ ))==NULL) { printf( Can not find a file of hangban!\n );

return ;

} while( !feof( fp1 ) ) { q = ( Linklist )malloc( sizeof( pnode ) );

fread( q, sizeof(pnode), 1, fp1 );

q->

next = p->

next;

q->

clist = initlink();

//初始化顾客链表连接到航班链表中 p->

next = q;

p = q;

} fclose( fp1 );

//打开顾客文件链接到航班链表 if((fp2=fopen( f:\\Client.txt , rb+ ))==NULL) { printf( Can not find a file of guke!\n );

return ;

} p=L->

next;

while( !feof( fp2 ) ) { h2 = ( link )malloc( sizeof(cnode) );

fread( h2, sizeof(cnode), 1, fp2 );

while(p &

&

p->

no!=h2->

hangbanh) p=p->

next;

if( p->

no==h2->

hangbanh) { h1=p->

clist;

while(h1->

next) h1=h1->

next;

//置到表尾 h2->

next=h1->

next;

h1->

next=h2;

h1=h2;

} } fclose(fp2);

} //释放内存 void disposeMemory( Linklist L ) { Linklist p = L->

next, q;

link h, h1;

while( p ) { h = p->

clist;

while( h ) { h1 = h->

next;

free( h );

h = h1;

} q = p->

next;

free( p );

p = q;

} free( L );

} ........

下载(注:源文件不在本站服务器,都将跳转到源网站下载)
备用下载
发帖评论
相关话题
发布一个新话题