求一个完整的数据结构程序(C语言)

求一个完整的数据结构程序(C语言),第1张

#include

"stdioh"

#include

"malloch"

#define

null

0

struct

node

/定义结构体/

{int

data;

struct

node

next;

};

struct

node

head;

struct

node

p;

struct

node

s;

void

creat()

/创建单链表/

{int

ch;

head=(struct

node

)malloc(sizeof(struct

node));

head->next=null;

p=head;

printf("请输入数据:

");

scanf("%d",&ch);

while(ch!=-1)

{s=(struct

node

)malloc(sizeof(struct

node));

s->data=ch;

s->next=null;

p->next=s;

p=s;

printf("请输入数据:

");

scanf("%d",&ch);

}

}

void

outline()

/输出单链表/

{p=head->next;

while(p!=null)

{printf("%d

",p->data);

p=p->next;

}

printf("\n");

}

int

locate(int

x)

/按值查找/

{p=head->next;

while((p!=null)&&(p->data!=x))

p=p->next;

if(p==null)

return

0;

else

return

(p->data);

}

main()

/主函数/

{int

a=0;

creat();

outline();

printf("请输入你要找的数:\n");

scanf("%d",&a);

printf("你要找的数的下标是:

%d\n",locate(a));

printf("结点个数是:

%d\n",countnode());

}

 一个完整的数控加工程序由:开始符、程序名、程序结束指令、结束符等组成。

常用指令:G功能(准备功能)、M功能(辅助功能)、F功能(进给功能)、S功能(主轴旋转功能)、T功能(刀补功能)指令等 。

指令通常由地址符和数字符组成。

模态指令:在程序段中一经指定持续有效,直到被同组其它指令替代为止的代码,非模态指令只在本程序中有效。

以上就是关于求一个完整的数据结构程序(C语言)全部的内容,包括:求一个完整的数据结构程序(C语言)、一个完整的LSF打印程序包含几部分主要包含什么内容、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/9720042.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-01
下一篇2023-05-01

发表评论

登录后才能评论

评论列表(0条)

    保存