好文档 - 专业文书写作范文服务资料分享网站

数据结构课程设计_集合运算(完整)

天下 分享 时间: 加入收藏 我要投稿 点赞

.

{

m=m->next;

}

if(m->coef==n->coef)

{

k=(struct set *)malloc(sizeof(set)); k->next=r->next; r->next=k; k->coef=m->coef;

}

n=n->next; }

}//求A∩B

void Intset(struct set *&p,struct set *&q,struct set *&r) {

struct set *k,*m,*n;

r=(struct set *)malloc(sizeof(set)); r->next=NULL; m=p->next; for(;m;) {

.

.

n=q->next;

for(;(m->coef!=n->coef)&&n->next;)

{

n=n->next;

}

if(!n->next&&(m->coef!=n->coef))

{

k=(struct set *)malloc(sizeof(set)); k->next=r->next; r->next=k; k->coef=m->coef;

}

m=m->next; } }//求A-B void bangzhu(){

printf(\printf(\求集合的交并差 *\

printf(\}

void main() {

.

.

struct set *p,*q,*r; int m,n,node; bangzhu();

for(;;) { do{

printf(\请输入您要选择操作的代码:\\n\ printf(\:求两集合的并A∪B\\n\ printf(\:求两集合的交A∩B\\n\ printf(\:求两集合的差A-B\\n\ printf(\:退出该程序\\n\ scanf(\

if(node==0) exit(1);

printf(\请输入集合A中元素的个数:*/\\n\ scanf(\ createlist_p(p,m);

printf(\请输入集合B中元素的个数:*/\\n\ scanf(\ createlist_p(q,n);

} while(node<0||node>3);

.

.

printf(\集合A中元素为:\ printlist_p(p); printf(\集合B中元素为:\ printlist_p(q); while(node<0||node>3); switch(node) {

case 1: Addset( p,q,r);printf(\∪B:\\n\case 2: Subset( p,q,r);printf(\∩B:\\n\case 3: Intset(p,q,r); printf(\}

printf(\ } }

八 总结

通过这次数据结构的课程设计,加深对所学知识理解的同时也将所学知识系统化。经过这几天的思考发现,数据结构自己学习的有多么的糟糕和肤浅,最初的程序之中有许多的漏洞和不足,调试之中不断出现错误,自己无法解决。向老师同学请教之后才得以解决,我深刻的意识到我与其他同学的差距,所幸通过这

.

.

次课程设计能够是自己有所提高

本程序经过的反复修改和调试,发现错误,解决错误,才能在正常运行,有正确的结果。兴奋之余也深深体会到编程的工作人员的不易,希望自己能将现在的收获应用到以后的工作中。

九 参考文献

1.c语言程序设计 清华大学出版社 2.数据结构 严蔚敏版 清华大学出版社 3.c++面向对象程序设计 清华大学出版社 4.c++语言课程设计 清华大学出版社 5.上网查阅的有关停集合的运算的资料

.

数据结构课程设计_集合运算(完整)

.{m=m->next;}if(m->coef==n->coef){k=(structset*)malloc(sizeof(set));k->next=r->next;r->next=k;
推荐度:
点击下载文档文档为doc格式
2i6qh634g7207lq1bbd16zh7s4eqd201d1t
领取福利

微信扫码领取福利

微信扫码分享