摘要: 代码如下:#include<stdio.h>#include<stdlib.h>structllist{intnum;structllist*next;};typedefstructllistnode;typedefnode*llink;voidprintllist(llinkptr)//链表输出{while(ptr!=NULL){printf("[%d]",ptr->num);ptr=ptr->next;}printf("\n");}//链表的创建llinkcreatellist(int*array,intlen){ 阅读全文
posted @ 2011-03-13 17:15 草珊瑚 阅读(1039) 评论(0) 推荐(0) 编辑
摘要: 有两个整形数组A和B,请编程去除这两个数组间的交集。若有相同元素,则在相同元素较多的数组中保留它。例如,数组A有三个1,数组B有两个1,程序将删除数组B中的两个1.只能讲讲思路,因为我做不出来。举个例子:数组a,11123数组b,1122224经程序运行后,结果数组a为1113数组b为222240.数组a和数组b的交集。放在数组c。计算出数组c的长度strlne。1.统计数组a与数组c相同元素的个数ua[]。统计数组b与数组c相同元素的个数ub[]。2.进行个数比较ua[] > ub[]。循环次数是strlen。3.如果,ua[strlne] > ub[strlne]进行数组b的c 阅读全文
posted @ 2011-03-13 17:13 草珊瑚 阅读(1480) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<stdlib.h>#defineN5int*func(int*x,int*y){staticintt=0;if(*x<*y){t+=*x;printf("%d\n",t);returnx;}else{t+=*y;printf("%d\n",t);returnx;}}intmain(intargc,char*argv[]){inti;intx=3;int*p,*q,*r;q=&x;for(i=1;i<=N;i++){p=&i;r=func(p,q);}/ 阅读全文
posted @ 2011-03-13 12:12 草珊瑚 阅读(543) 评论(0) 推荐(0) 编辑