#include <stdio.h>
#include <string.h>
struct Node {
char num[50];
Char name[50];
int grade;
Node *next;
};
Node a[1000];
int main ()
{
node *p;
p=&a[0];
int i=0;
while (~SCANF ("%s%s%d", A[i].num,a[i].name,&a[i].grade))
{
if (strcmp (A[i].num, "0") ==0&& strcmp (A[i].name, "0") ==0&&a[i].grade==0) break;
a[i].next=&a[i+1];
A[i+1].next=null;
i++;
}
while (P->next!=null)
{
printf ("%s%s%d\n", P->num,p->name,p->grade);
p=p->next;
}
return 0;
}
Build student information with structure, student information including number, name, score, build a chain of n students
Table and outputs the linked list. Description
Enter student information at a time including number, name. 0 0 0 End program Input
Output from the linked list header to the table bit in turn. Output
1 2 3 4 5 6 |
C1001 Li M1002 He E1003 Xie, M1004 Wu, E1005 Bao 80 0 0 0 |
Sample Input
1 2 3 4 5 |
C1001 Li M1002 He E1003 Xie M1004 Wu 80 E1005 Bao /td> |