Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C# Student Score Query System
C# Student Score Query System
/* menu function, the return value is integer */

menu_select()

{

Char * menu [] = {* * * * * * * * menu * * * * * * * * * * * * * * * * * * * * *,/* defines the menu string array */

"0. Initialize list", /* Initialize */

"1. input list",/* input record */

"2. Delete the record from the list",/* Delete the record from the table */

"3. Print list",/* Displays all records in the single linked list */

"4. Search records by name",/* Find records by name */

"5. Save the file",/* Save the records in the single linked list to a file */

"6. Load the file",/* Read the record from the file */

"7. Calculate scores",/* Calculate the total score and average score of all students */

"8. Insert the record into the list",/* Insert the record into the table */

"9. Copy the file to a new file"./* Copy the file */

"10. Sort to generate a new file", /* Sort */

"1 1. Append record to file",/* Append record to file */

"12. Index on number", /* index */

"13. Total figures",/* Total by category */

"14. Exit"}; /* Exit */

char s[3]; /* Save the selection number in character form */

int c,I; /* Define an integer variable */

gotoxy( 1,25); /* Move the cursor */

Printf ("Press any key to enter the menu ... \ n"); /* Press any key to enter the main menu */

getch(); /* Enter any key */

clr SCR(); /* Clear the screen */

gotoxy( 1, 1); /* Move the cursor */

Textcolor (yellow); /* Set the text display color to yellow */

Textbackground (blue); /* Set the background color to blue */

gotoxy( 10,2); /* Move the cursor */

putch(0xc 9); /* Output the upper left corner border ┏ */

for(I = 1; I & lt44; i++)

putch(0x CD); /* Output the top border horizontal line */

putch(0x bb); /* Output the upper right corner border ┓ */

for(I = 3; I & lt20; i++)

{

gotoxy( 10,I); putch(0x ba); /* Output left vertical line */

gotoxy(54,I); putch(0x ba);

}/* Output right vertical line */

gotoxy( 10,20); putch(0x c8); /* Output the upper left corner border ┗ */

for(I = 1; I & lt44; i++)

putch(0x CD); /* Output bottom border horizontal line */

putch(0x BC); /* Output the lower right corner border ┛ */

Window (1 1, 3,53,19); /* Make a window showing menus, and the size of the window is designed according to the number of menus */

clr SCR(); /* Clear the screen */

for(I = 0; I< 16; I++) /* Output main menu array */

{

gotoxy( 10,I+ 1);

cprintf("%s ",menu[I]);

}

Textbackground (black); /* Set the background color to black */

Window (1, 1, 80, 25); /* Restore the original window size */

gotoxy( 10,2 1); /* Move the cursor */

Do {

Printf ("\ nEnter your choice (0 ~14):"); /* Display prompt information outside the menu window */

scanf("%s ",s); /* Enter options */

c = atoi(s); /* Convert the input string into an integer */

} while(c & lt; 0 | | c >; 14); /* The selected item is not between 0 and 14. Please re-enter */

Return to c; /* Returns the option, and the main program calls the corresponding function according to the number */

}

Student *init ()

{

Returns NULL

}

/* Create a linked list */

Student * Create ()

{

int I; int s;

STUDENT *h=NULL, * info/* student pointer to structure */

for(; ; )

{

Info= (student *)malloc(sizeof)); /* Apply for space */

If (! Info) /* If the pointer information is empty */

{

Printf(" \ n Out of memory "); /* Output memory overflow */

Return NULL/* Return null pointer */

}

Enter ("input number:", information-> No,11); /* Enter the student number and check */

if(info-& gt; There is no [0]=='@') delimiter; /* If the first character of the student number is @, the input is over */

Enter ("Enter name:", information-> Name,15); /* Enter the name and check */

Printf ("Please enter %d score \n", n); /* Prompt to start entering scores */

s = 0; /* Calculate the total score of each student, with an initial value of 0*/

for(I = 0; I & ltn;; I++) /*N courses are circulated n times */

{

Do {

Printf ("score %d:", I+1); /* Prompt which course to attend */

Scanf("%d ",& Info-> score[I]); /* Enter the score */

if(info-& gt; score[I]& gt; 100 | | information->; score[I]& lt; 0) /* Make sure the score is between 0~ 100 */

Printf ("bad data, repeated input \ n"); /* Error message */

} while(info-& gt; score[I]& gt; 100 | | information->; score[I]& lt; 0);

s = s+info-& gt; Score [I]; /* Accumulate the scores of various courses */

}