#include"stdio.h"
#include"stdlib.h"
struct jiedian
{
char ming[20];
int xuehao;
struct jiedian* next;
};
int i;
struct jiedian* coo()
{
i = 0;
struct jiedain* head = NULL;
struct jiedain* pnew, * pend;
pnew = pend = (struct jiedian*)malloc(sizeof(struct jiedian));
printf("请输入学生信息姓名和学号;\n");
scanf("%s", &pnew->ming);
scanf("%d", &pnew->xuehao);
while (pnew->xuehao != 0)
{
i++;
if (i == 1)
{
pnew->next = head;
pend = pnew;
head = pnew;
}
else
{
pnew->next = NULL;
pend->next = pnew;
pend = pnew;
}
pnew = (struct jiedian*)malloc(sizeof(struct jiedian));
scanf("%s", &pnew->ming);
scanf("%d", &pnew->xuehao);
}
free(pnew);
return head;
}
void print(struct jiedian* head)
{
int p;
struct jiedian* l;
l = head;
if (i = 0)
{
printf("没有一个成员");
}
else
{
for (p = 0;p < i;p++)
{
printf("第%d个成员是:\n", i);
if (i = 1)
{
printf("%s", l->ming);
printf("%d", l->xuehao);
}
else
{
l = l->next;
printf("%s", l->ming);
printf("%d", l->xuehao);
}
}
}
}
int main()
{
struct jiedian* head;
head = coo();
print(head);
return 0;
}