主题:大神求救啊~~~这是神马情况....
#include<stdio.h>
typedef struct
{
int n;
char name[20];
int score;
}element;
typedef struct seqlist
{
element elem[100];
int length;
}seqlist;
int init_seqlist(seqlist *l)
{
l->length=0;
}
void creat_seqlist(seqlist *l,int x)
{
int i;
init_seqlist(l);
for(i=0;i<x;i++)
{
printf("N0.");
scanf("%d",&l->elem[i].n);
printf("name:");
scanf("%s",l->elem[i].name);
printf("score:");
scanf("%d",&l->elem[i].score);
}
l->length=x;
}
void print_seqlist(seqlist *l,int x)
{
int i;
for(i=0;i<x;i++)
{
printf("NO.%d\t",l->elem[i].n);
printf("name:%s\t",l->elem[i].name);
printf("score:%d\t",l->elem[i].score);
printf("\n");
}
}
main()
{
seqlist *book;
int n=3;
creat_seqlist(book,n);
print_seqlist(book,n);
}
typedef struct
{
int n;
char name[20];
int score;
}element;
typedef struct seqlist
{
element elem[100];
int length;
}seqlist;
int init_seqlist(seqlist *l)
{
l->length=0;
}
void creat_seqlist(seqlist *l,int x)
{
int i;
init_seqlist(l);
for(i=0;i<x;i++)
{
printf("N0.");
scanf("%d",&l->elem[i].n);
printf("name:");
scanf("%s",l->elem[i].name);
printf("score:");
scanf("%d",&l->elem[i].score);
}
l->length=x;
}
void print_seqlist(seqlist *l,int x)
{
int i;
for(i=0;i<x;i++)
{
printf("NO.%d\t",l->elem[i].n);
printf("name:%s\t",l->elem[i].name);
printf("score:%d\t",l->elem[i].score);
printf("\n");
}
}
main()
{
seqlist *book;
int n=3;
creat_seqlist(book,n);
print_seqlist(book,n);
}