<> Student management system (C/C#) Detailed code and software design specification

( Useful words for you , Remember to recommend it to your friends , Like it ! Thank you !)
**
Practice project I , Design and implementation of student management system
Design and implement a student management system , That is, define a ( Student ID , full name , achievement ) Sequence table of , Duplicate names may not be considered , The system shall at least include the following functions :
(1) According to the number of students specified , Enter student information one by one ;
(2) Show information about all students in the student table one by one ;
(3) Given a student information , Insert to the location specified in the table ;
(4) Delete student records at the specified location ;
(5) Number of students in the statistical table ;
(6) Using quick sort to sort by student number ;
(7) Direct insertion sort and half insertion sort are used to sort by grades respectively ;
(8) Search by half according to the score , Student ID and name of this student returned successfully .

**
#include<stdio.h> #include<malloc.h> #include<stdlib.h> #include<string.h> #
define OK 1 #define ERROR 0 #define OVERFLOW -2 #define MAXSIZE 100 typedef int
Status; // Define function return value type typedef struct { double no; // Student ID char name[20]; // full name
double grade; // achievement }student; typedef student ElemType; typedef struct {
ElemType*elem; // Base address of storage space int length; // Current length }SqList; Status InitList(SqList *
L) // Construct an empty sequence table L { L->elem=(ElemType *)malloc(sizeof(ElemType)*MAXSIZE);
// Assign a size of MAXSIZE Space for if(!L->elem) exit(OVERFLOW); L->length=0; return OK; }
ElemTypeGetElem(SqList &L,int i) // Access sequence table , find i position , Return to e { return L.elem[i]; }
void Input(ElemType* e) { printf(" Student ID :"); scanf("%lf", &e->no); printf(" full name :");
scanf("%s", &e->name); printf(" achievement :"); scanf("%lf", &e->grade); printf(" Input complete \n\n"
); } void Output(ElemType* e) { printf(" Student ID (6 In bit ):%-10.0lf\t full name :%-20s\t
achievement :%-10.1lf\t\n", e->no, e->name, e->grade); } int Patition(SqList* L,int low,
int high) { // Quick sort to sort by student number // Exchange sequence table L Neutron meter r[low..high] Records of , Pivot record in place , And return to its location
// Now before it ( after ) Records of are not greater than ( less than ) it L->elem[0] = L->elem[low]; // Use the first record of the sub table as the pivot record int pivotkey
= L->elem[low].no; // Pivot record key while (low < high) { // Scan from both ends of the table to the middle while (low < high
&& L->elem[high].no>= pivotkey) --high; L->elem[low] = L->elem[high];
// Move records smaller than the pivot to the low end while (low < high && L->elem[low].no <= pivotkey) ++low; L->elem
[high] = L->elem[low]; // Move records larger than the pivot to the high end } L->elem[low] = L->elem[0]; // Pivot record in place
return low; // Return to pivot position } void QSort(SqList* L, int low, int high) {
// Sequence table L Subsequences in L.r[low...high] Do quick sort if (low < high) { // Length greater than or equal to 1 int pivotloc =
Patition(L, low, high); // one divides into two QSort(L, low, pivotloc - 1); // Recursively sort low child tables QSort(L,
pivotloc+ 1, high); // Recursively sort high child tables } } void QuickSort(SqList* L) { // Sequence table L Do quick sort
QSort(L, 1, L->length); } /*void InsertSort(SqList& L) {// Sequence table L Do direct insert sort , Sort by student grade
int i, j; for(i=2;i<=L.length;i++) if (L.elem[i].grade < L.elem[i -
1].grade)//“<”, Need to elem[i] Insert ordered child table { L.elem[0] = L.elem[i]; // Temporary storage of records to be inserted in the monitoring post
L.elem[i] = L.elem[i-1];//elem[i-] Move back for (j = i - 2; L.elem[0].grade <
L.elem[j].grade; --j)// Find insertion position from back to front L.elem[j + 1] = L.elem[j];// Record moves backward step by step , Until the insertion position is found
L.elem[j + 1] = L.elem[0];// take elem[0] Namely original elem[i], Insert in correct position } }*/ void BInsertSort(
SqList& L) { // Sequence table L Do split insert sort , Sort by student grade int i, j, m, low, high; for (i = 2; i <= L.
length; ++i) { L.elem[0] = L.elem[i];// Temporary storage of records to be inserted in the monitoring post low = 1; high = i - 1;
// Set initial value of search interval while (low <= high) // stay elem[low..high] Half find where to insert { m = (low + high) /
2; // Halve if (L.elem[0].grade < L.elem[m].grade) high = m - 1;// Insert point in previous sub table else low
= m + 1; // Insert point in the next child table } for (j = i - 1; j >= high + 1; --j) L.elem[j + 1] = L.elem
[j];// Record backward L.elem[high + 1] = L.elem[0];// take elem[o] Namely original elem[i], Insert in correct position } } Status
Search(SqList* L, int f)// Users provide scores based on half search , The system returns the student information { int low = 1, high = L->
length, mid; while (low <= high) { mid = (low + high) / 2; if (L->elem[mid].
grade== f) Output(&L->elem[mid]); if (L->elem[mid].grade > f) { high = mid - 1;
} else { low = mid + 1; } } return 0; } int Search(SqList &L,char str[]) //
Find by name , Return the student's number in the sequence table { for(int i=1;i<=L.length;i++) { if(strcmp(L.elem[i].name,
str)==0) return i; } return 0; } Status ListInsert(SqList &L,int i,ElemType e)
// stay Insert a student's information at the specified location { if((i<1)||(i>L.length+1)) return ERROR; if(L.length==
MAXSIZE) return ERROR; for(int j=L.length;j>=i;j--) { L.elem[j+1]=L.elem[j]; } L
.elem[i]=e; ++L.length; return OK; } Status ListDelete(SqList &L,int i) //
Delete in sequence table i Student information for location { if((i<1)||(i>L.length)) return ERROR; for(int j=i;j<=L.length
;j++) { L.elem[j]=L.elem[j+1]; } --L.length; return OK; } int main() { SqList L;
ElemType a,b,c; printf("******** Welcome to the student information management system ********\n"); printf(
"\n************** Main menu ******************\n\n"); printf("1. Construction sequence table \n"); // Store student information
printf("2. Enter student information \n"); // According to the number of students specified , Enter student information one by one printf("3. Show student information \n");
// call OutPut Function to realize traversal of stored data printf("4. Enter name , Find this student \n");// Find the student's information by the student's name printf("5.
Display the student information at a certain location \n"); // Student information at a location in the table printf("6. Insert student information at the specified location \n"); printf("7.
Delete student information at the specified location \n"); printf("8. Count the number of students \n"); printf("9. Sort by student grade \n"); printf(
"10. Find student information based on specified scores \n"); printf("0. sign out \n"); printf(
"\n**************************************\n\n"); int x,i,f,number; while(1) {
printf("\n Please enter the number corresponding to the required function \n"); scanf("%d",&number); if(number==0) break; switch(
number) { case 1: if(InitList(&L)) printf(" Sequence table successfully established \n\n"); else printf(
" Sequence table creation failed \n\n"); break; case 2: printf(" Please enter the number of students to be entered ( less than 100):\n"); scanf("%d",&x);
for(int i=1;i<=x;i++) { printf(" Section %d Students :\n",i); Input(&L.elem[i]); } L.length=x;
break; case 3: QuickSort(&L); // Using quick sort to sort by student number for(int i=1;i<= L.length;i++) {
Output(&L.elem[i]); } break; case 4: char s[20]; printf("\n Please enter the name of the student you want to find :\t");
scanf("%s",s); if(Search(L,s)) Output(&L.elem[Search(L,s)]); else puts(
" I'm sorry , No such person found "); break; case 5: printf("\n Please enter the location to query :"); int id1; scanf("%d",&id1); b
=GetElem(L,id1); Output(&b); break; case 6: printf ("\n Please enter the location to insert :"); int id2;
scanf("%d",&id2); printf(" Please enter student information :\n"); Input(&c); if(ListInsert(L,id2,c)) { x++
; puts(" Insert successful "); } else { puts(" Insert failed "); } break; case 7: printf("\n Please enter the location to delete :\n")
; int id3; scanf("%d",&id3); if(ListDelete(L,id3)) { x--; puts(" Deletion succeeded "); } else {
puts(" Delete failed "); } break; case 8: printf("\n The number of students entered is :%d\n\n",L.length); break;
case 9: puts("\n Sorted by grade :\n"); BInsertSort(L); for (int i = 1; i <= L.length; i++
) { //InsertSort(L); Output(&L.elem[i]); } break; case 10: printf(
"\n Please enter the score you want to find :\n"); scanf("%d",&f); Search(&L,f); puts("\n"); break; } } printf(
"\n\n Thank you for your use , Please press any key to exit \n\n\n"); system("pause"); return 0; } `` ##
The software design specification is under this blog , Please go to my blog to check , thank you !

Technology