68、69题得出 如果输出连表必须用,do{}while();
71.
用结构体时定义函数,函数不能有类型,如
input(stu)
struct student stu[];
输入,输出5个学生的数据记录。类时,要输入string最好用char name[8];这种形式
===
计划把数据结构加到计划中。。。。把数据结构算法用c实现。。
72
通过作体 ,进一步规范了,结构体连表的写发
ptr=(link)malloc(sizeof(node));
ptr=head;
for(i=0;i<=4;i++)
{
scanf("%d",&num);
ptr->data=num;--------------------先赋值解决了,head空数据的问题
ptr->next=(link)malloc(sizeof(node));
if(i==4) ptr->next=NULL;
else ptr=ptr->next;
}-------------------------------并且此循环只用了1个point,不同于浩男的2 point
-----------并且 最后输出时,在这种情况下可以用,while直接输出,而不用dowhile
74
#include "stdio.h"
struct link
{
int n;
struct link *next;
}
main()
{
int i;
struct link *p1,*p2,*h1,*h2;
p1=h1=(struct link *)malloc(sizeof(struct link));
for(i=0;i<=5;i++)
{
p1->n=i;
p1->next= (struct link *)malloc(sizeof(struct link));
p1=p1->next;
}------------------------------------------------------------------------------------------------------
p1->next=NULL;
p2=h2=(struct link *)malloc(sizeof(struct link));
for(i=6;i<=10;i++)
{
p2->n=i;
p2->next= (struct link *)malloc(sizeof(struct link));
p2=p2->next;
}
p2->next=NULL;
p1->next=h2;
p1=h1;
while(p1->next!=NULL)
{
printf("%d/t",p1->n);
p1=p1->next;
}
getch();
}
衔接不好,8过感觉程序写的很好读,呵呵
注:已解决在--------------少了p1的一个赋值。。。花50分问的 嘎嘎
76
呵呵,100例的76又错了,偶数的算法错误
第几个了这是。。
77
真是背过了。。。@.@
78
要求找问题?猜是如果同岁吧。。
貌似不是。。