Home > database >  An ordinary primary school students information list, everyone can help me have a look at why rutime
An ordinary primary school students information list, everyone can help me have a look at why rutime

Time:09-28

# include & lt; stdio.h>
# include & lt; Stdlib. H>
# include & lt; String. H>
# define maxsize 20
Typedef int intype;
Typedef char chtype;
Typedef float gratype;
Typedef struct DATA1
{
Chtype name [6].
Intype age;
Intype id;
Chtype sex [2].
Intype classes;
Gratype English;
Gratype Maths;
Gratype Chinese;
} primary;

Typedef struct LNode
{
Primary adata;
Struct LNode * anext;
} point, * link;

The link acreate ()
{
Q point * and * ahead, * L;
Intype I, n, k, j;
L=ahead=(point *) malloc (sizeof (point));
Ahead - & gt; Anext=NULL;
Printf (" please input the number of pupils: ");
The scanf (" % d ", & amp; N);
for(i=0; i{
L - & gt; Anext=(point *) malloc (sizeof (point));
Printf (" \ n please instructed to enter the first % d an elementary student's information: \ n ", I + 1);
Printf (" name: ");
The scanf (" % s ", & amp; L - & gt; Adata. Name);
Printf (" student number: ");
The scanf (" % d ", & amp; L - & gt; Adata. Id);
for(k=0; K{
Q=ahead - & gt; Anext;
If (q - & gt; Adata. Id==q - & gt; Anext - & gt; Adata. Id)
{
Printf (" repeated data, add failure! \n");
Q - & gt; Anext=NULL;
Q=q - & gt; Anext;
J=1;
continue;
}
Q=q - & gt; Anext;
}
If (j==1) continue;
Printf (" age: ");
The scanf (" % d ", & amp; L - & gt; Adata. Age);
Printf (" gender: ");
The scanf (" % s ", & amp; L - & gt; Adata. Sex);
Printf (" class: ");
The scanf (" % d ", & amp; L - & gt; Adata. Classes);
Printf (" English score: ");
The scanf (" % f ", & amp; L - & gt; Adata. English);
Printf (" math score: ");
The scanf (" % f ", & amp; L - & gt; Adata. Maths);
Printf (" the language points: ");
The scanf (" % f ", & amp; L - & gt; Adata. Chinese);
L=L - & gt; Anext;
L - & gt; Anext=NULL;
}
Return ahead;
}

Void main ()
{
Point * L;
L=acreate ();
}
  • Related