Home > database >  That part of the circle running out, a great god answers
That part of the circle running out, a great god answers

Time:09-26

CodePudding user response:

#include
#include
#include
Typedef struct sxm1
{
Char sxmname [25];
Sxm1 * next;
} sxm1;
Typedef struct stu1
{
Char xname [25];
Stu1 * next;
} stu1;
Struct xm
{
Char xmname [25];
Stu1 * xmhead;
} xm [1000];
Struct student
{
int num;
Char name [10].
Char sex [10].
Int id;
Sxm1 * stuhead;
} stu [100].

Void change ()
{
Int I, k, tp=0;
SXM char sna [25], [25];
Sxm1 * a;
Stu1 * c * d;
Printf (" input name \ n ");
The scanf (" % s ", sna);
For (I=0; i <100; I++)
{
If (STRCMP (sna, stu [I] name)==0)
{
Tp=1;
break;
}

}
If (tp==0)
{
Printf (" the man didn't sign up \ n ");
return;
}
Printf (" input to change project \ n ");
The scanf (" % s ", SXM);
A=stu [I] stuhead;
While (a!=NULL)
{
If (STRCMP (SXM, a. & gt; Sxmname)==0)
{
For (k=0; K & lt; 1000; K++)
{
If (STRCMP (SXM, xm [k]. Xmname)==0)
{
C=xm [k]. Xmhead;
While (c!=NULL)
{
If (STRCMP (stu [I]. Name, c - & gt; Next - & gt; Xname)==0)
{
If (c - & gt; Next - & gt; Next==NULL)
C - & gt; Next=NULL;
The else
C - & gt; Next=c - & gt; Next - & gt; next;
break;
}
}
break;
}
}
Printf (" input change after project \ n ");
The scanf (" % s ", a - & gt; Sxmname);
For (k=0; K & lt; 1000; K++)
{
If (STRCMP (a - & gt; Sxmname, xm [k]. Xmname)==0)
{
C=xm [k]. Xmhead;
While (c - & gt; Next!=NULL)
C=c - & gt; next;
D=(stu1 *) malloc (sizeof (struct stu1));
Strcpy (d - & gt; Xname, stu [I] name);
C - & gt; Next=d;
D - & gt; Next=NULL;
break;
}
}
break;
}
A=a - & gt; next;
}

}

Void main ()
{
Char n, m;
Int I=0, j, xnum;
Int k;
Int a, s, d, f;
Char b;
Printf (" u u u u u u u games registration system painted painted u u u u u \ n ");
Printf (" \ n (1) 100 meters (2) (3) the high jump jump (4) the shot put \ n ");
Do {
Printf (" \ n u u u u 1, began to register u u u u \ n ");
Printf (" u u u u 2, modify the project quoted u u u u \ n ");
Printf (" u u u u 3, painted painted painted painted classification statistics registration results \ n ");
Printf (" u u u u 4, quit u u u u \ n ");
Printf (" \ n please select: ");
The scanf (" % c ", & amp; N);
The switch (n)
{
Case 1 ':
Do
{
Printf (" please enter the following \ n \ n \ n ");
Printf (" student id: \ n ");
The scanf (" % d ", & amp; Stu [I] num);
While (stu [I] num==0)
{
Printf (" \ n student id cannot be zero! \n");
Printf (" student id: \ n ");
The scanf (" % d ", & amp; Stu [I] num);
}
Printf (" name: \ n ");
The scanf (" % s ", & amp; Stu [I] name);
Gender: printf (" \ n ");
The scanf (" % s ", & amp; Stu [I] sex);
While ((STRCMP (stu [I] sex, "male")!=0) & amp; & (STRCMP (stu [I]. Sex, "female")!=0))
{
Printf (" \ n input error, please input again! \n");
Gender: printf (" \ n ");
The scanf (" % s ", & amp; Stu [I] sex);
}
Printf (" please enter registration number \ n ");
The scanf (" % d ", & amp; Xnum);
If (xnum & gt; 3)
{
Printf (" the project of more than 3 items, can't quote \ n ");
}

Printf (" item number (1 ~ 4) \ n ");
The scanf (" % d ", & amp; Stu [I]. Id);
While (stu [I] id & gt; 4 | | stu [I] id==0)
{
Printf (" \ n input error, please input again! \n");
Printf (" item number (1 ~ 4) \ n ");
The scanf (" % d ", & amp; Stu [I]. Id);
}
i++;
Printf (" \ n willing to continue & lt; Y/N> : ");
The fflush (stdin);
The scanf (" % c ", & amp; B);
} while (b==y '| |==b y');
break;
Case 2 ': change (); break;
Case 3 ':
Do {
Printf (" \ n1, by sex query \ n ");
Printf (" 2, according to the project quoted query \ n ");
Printf (" 3, exit, \ n ");
Printf (" \ n please select: ");
The scanf (" % c ", & amp; M);
The switch (m)
{
Case 1 ':
K=0;
For (j=0; J & lt; i; J++)
{
If (STRCMP (stu [j]. Journal of sex, "male")==0)
{
k++;
}
}
Printf (" \ n % d boys are there people attending the games, girls have % d people, \ n ", k, I - k);
break;
Case 2 ':
a=0;
S=0;
D=0;
F=0;
For (j=0; J & lt; i; J++)
{
If (stu [j]. Id==1)
{
a++;
}
If (stu [j]. Id==2)
{
S++;
}
If (stu [j]. Id==3)
{
D++;
}
If (stu [j]. Id==4)
{
F++;
}
}
Printf (" \ n at running project with a total of % d % d \ n in the high jump project of adults \ n people to participate in the project, a total of % d \ n in shot put project with a total of % d \ n ", a, s, d, f);
break;
}
The fflush (stdin);
} while (m!=3 ');
break;
}
The fflush (stdin);
} while (n!=4 ');
}

CodePudding user response:

Don't ask, the general nobody reply, you have to learn how to debug; Then go to the corresponding BBS asked,
  • Related