#include<stdio.h>
#include<stdlib.h>
struct Student
{
char nName[20];
int num;
struct Student* pNext;
};
int iCount;
struct Student* create()
{
struct Student* pHead = NULL;
struct Student* pEnd, *pNew;
pEnd = pNew = (struct Student*)malloc(sizeof(struct Student));
iCount = 0;
scanf_s("%s",pNew->nName);
scanf_s("%d", pNew->num);
while (pNew->num != 0)
{
iCount++;
if (iCount == 1)
{
pNew->pNext = NULL;
pEnd = pNew;
pHead = pEnd;
}
else
{
pNew->pNext = NULL;
pEnd->pNext = pNew;
pHead = pEnd;
}
scanf_s("%s", pNew->nName);
scanf_s("%d", pNew->num);
}
free(pNew);
return pHead;
}
void Print(struct Student* pHead)
{
struct Student* pTemp;
pTemp = pHead;
while (pTemp != NULL)
{
printf("%s",pTemp->nName);
printf("%d", pTemp->num);
pTemp = pTemp->pNext;
}
}
int main()
{
struct Student* pHead;
pHead = create();
Print(pHead);
return 0;
}