友情提示:如果本网页打开太慢或显示不完整,请尝试鼠标右键“刷新”本网页!阅读过程发现任何错误请告诉我们,谢谢!! 报告错误
次次小说 返回本书目录 我的书架 我的书签 TXT全本下载 进入书吧 加入书签

c语言教程-第34章

按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!



#include 〃stdio。h〃
#include 〃graphics。h〃
#include 〃conio。h〃
main()

int x=360;y=160;driver=VGA;mode=VGAHI;
int num=20;i;
int top;bottom;
initgraph(&driver;&mode;〃〃);
top=y…30;
bottom=y…30;
for(i=0;inext;
while(ptr!=NULL)
{ printf(〃The value is 》%dn〃;ptr…》data);
 ptr=ptr…》next;
}}

【程序74】
题目:连接两个链表。
1。程序分析:
2。程序源代码:
#include 〃stdlib。h〃
#include 〃stdio。h〃
struct list
{ int data;
struct list *next;
};
typedef struct list node;
typedef node *link;
link delete_node(link pointer;link tmp)
{if (tmpNULL) /*delete first node*/
 return pointer…》next;
else
{ if(tmp…》next…》nextNULL)/*delete last node*/
  tmp…》next=NULL;
 else /*delete the other node*/
  tmp…》next=tmp…》next…》next;
 return pointer;


void selection_sort(link pointer;int num)
{ link tmp;btmp;
 int i;min;
 for(i=0;idata;
 btmp=NULL;
 while(tmp…》next)
 { if(min》tmp…》next…》data)
 {min=tmp…》next…》data;
  btmp=tmp;
 }
 tmp=tmp…》next;
 }
printf(〃40: %dn〃;min);
pointer=delete_node(pointer;btmp);


link create_list(int array'';int num)
{ link tmp1;tmp2;pointer;
int i;
pointer=(link)malloc(sizeof(node));
pointer…》data=array'0';
tmp1=pointer;
for(i=1;inext=NULL;
 tmp2…》data=array'i'
返回目录 上一页 下一页 回到顶部 0 0
未阅读完?加入书签已便下次继续阅读!
温馨提示: 温看小说的同时发表评论,说出自己的看法和其它小伙伴们分享也不错哦!发表书评还可以获得积分和经验奖励,认真写原创书评 被采纳为精评可以获得大量金币、积分和经验奖励哦!