Home > Back-end >  Save the children banging slammed kowtow
Save the children banging slammed kowtow

Time:11-29

Results query system
Involving ownership of circulation, the binary operation, the structure array,
Design program to realize student achievement query, specific requirements are as follows:
(1) student performance information is stored in the binary data file,
(2) the result of adding: according to the input of student achievement information (student id, name, class, term, English, high
Several grades, scores of language C), add the student's grades,
(3) the result shows: the output all the grades of the students,
(4) the results of the query: according to the student id, query and display the student's grades,
(5) the results of the query: according to class, query and display your grades,
(6) scores query: according to the course name, query and display all fail this course grades,
(7) systems work in menu way,










Here are on the Internet to find the code of change is good, to help



#include
#include
#include
# define lis struct stu
# define setup (lis *) malloc (sizeof (lis))

Int w=0;//record information insert number

Struct score
{
Float ord_scor;
//expe_scor exam_scor;//can increase students meet all kinds of grades, for easy, in this to ignore
};

Struct stu
{
int num;
Char name [10].
Struct score cl, semester, English, math, C;
Float fina_scor;
The lis * next;
};

The lis * p;

The lis * input ()//input student information
{
The lis * head, * tail;
Int CNT=0;
P=the setup;
Printf (" student id name English class term high number of C language \ n ");
The scanf (" % d ", & amp; P - & gt; Num);
While (1)
{
If (p - & gt; Num==0)
break;
cnt++;
The scanf (" % s % f % f % f % f % f ", p - & gt; The name, & amp; (p - & gt; Cl). Ord_scor, & amp; (p - & gt; Semester). Ord_scor, & amp; (p - & gt; English). Ord_scor, & amp; (p - & gt; Math). Ord_scor, & amp; (p - & gt; C). Ord_scor);
If (CNT==1)
{
The head=tail=p;
}
The else
{
Tail - & gt; Next=p;
Tail=p;
}
P=the setup;
The scanf (" % d ", & amp; P - & gt; Num);
}
Tail - & gt; Next=NULL;
W++;
Return (the head);
}


The lis * add (lis * head)//increase student information
{
The lis * tail, * z * q;
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1 ");
Q=tail=head;
While (q!=NULL)
{

For (int I=w; I>=1; I -)
{
Z=tail;//z point to the last but one node
Tail=q;
Q=q - & gt; Next;
}
break;
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 2 ");

}//tail - & gt; Next==NULL
P=the setup;
Printf (" please add student information (student id 0 is invalid, and the end) : \ n student id name English class term high number C \ n ");
//the scanf (" % d ", & amp; P - & gt; Num);
The scanf (" % d % s % f % f % f % f % f ", & amp; P - & gt; Num, p - & gt; The name, & amp; (p - & gt; Cl). Ord_scor, & amp; (p - & gt; Semester). Ord_scor, & amp; (p - & gt; English). Ord_scor, & amp; (p - & gt; Math). Ord_scor, & amp; (p - & gt; C). Ord_scor);
//the scanf (" % s % f % f % f % f % f ", p - & gt; The name, & amp; (p - & gt; Cl). Ord_scor, & amp; (p - & gt; Semester). Ord_scor, & amp; (p - & gt; English). Ord_scor, & amp; (p - & gt; Math). Ord_scor, & amp; (p - & gt; C). Ord_scor);
Int flag;
While (p - & gt; Num!=0)
{
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 3 ");
flag=0;
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//if (p - & gt; Num==0)
//break;
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
While (flag==0 | | flag==1)
{
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 4 ");
q=head;
While (q!=NULL)
{
For (int I=w; I>=1; I -)
{
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 5 ");
If (q - & gt; Num==p - & gt; Num)//student id repeat
{
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 6 ");
flag=1;
break;
}
The else
Q=q - & gt; Next;
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 7 ");
}
break;

}
If (flag==1)
{
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 8 ");
flag=0;
Printf (" already exist the student, please enter again: \ n ");
P=the setup;
The scanf (" % d % s % f % f % f % f % f ", & amp; P - & gt; Num, p - & gt; The name, & amp; (p - & gt; Cl). Ord_scor, & amp; (p - & gt; Semester). Ord_scor, & amp; (p - & gt; English). Ord_scor, & amp; (p - & gt; Math). Ord_scor, & amp; (p - & gt; C). Ord_scor);
}
The else
break;
}
Z - & gt; Next=p;
P - & gt; Next=tail;
Z=p;
P=the setup;
//-- -- -- -- -- -- -- -- -- -- -- --
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 9 ");
The scanf (" % d ", & amp; P - & gt; Num);
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 10 ");
//the scanf (" % d % s % f % f % f % f % f ", & amp; P - & gt; Num, p - & gt; The name, & amp; (p - & gt; Cl). Ord_scor, & amp; (p - & gt; Semester). Ord_scor, & amp; (p - & gt; English). Ord_scor, & amp; (p - & gt; Math). Ord_scor, & amp; (p - & gt; C). Ord_scor);
}
W++;
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 11 ");
Return (the head);
//printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 12 ");
}
Void search_print (lis * p)
{
//printf (" % d % 7 s % 8.2 f % 10.2 f % 10.2 f % 10.2 f % 10.2 f % 10.2 f \ n ", p - & gt; Num, p - & gt; The name, (p - & gt; Cl). Ord_scor, (p - & gt; Semester). Ord_scor, (p - & gt; English). Ord_scor, (p - & gt; Math). Ord_scor, (p - & gt; C). Ord_scor);
Printf (" % d % 7 s % 8.0 f % 8.0 f % 8.0 f % 10.2 f % 10.2 f % \ n ", p - & gt; Num, p - & gt; The name, (p - & gt; Cl). Ord_scor, (p - & gt; Semester). Ord_scor, (p - & gt; English). Ord_scor, (p - & gt; Math). Ord_scor, (p - & gt; C). Ord_scor);

}

Void search (lis * head, int key)//query student information in various ways to
{
The lis * q=head;
Int sear_num sear_class, sear_course, flag1=0, flag2=0;
Char sear_name [10].
If (key==3)
{
Printf (" please enter the student id: ");
The scanf (" % d ", & amp; Sear_num);
}
Else if (key==4)
{
Flag1=1;//tag according to class query
Printf (" please enter the class: ");
The scanf (" % d ", & amp; Sear_class);
}

Else if (key==5)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related