Student Information System

Source: Internet
Author: User

Implemented features: Add students, list student information lists, delete students, exit, repeat check, sorting function, multi-subjects score input (average score, and total average score), save records, read records, modify the function; Features to be implemented: query ...
1 Create file, start writing, add student function, increase list student function, add delete student function, exit version 1.0
2 changes: Increase the number of duplicate check function, repair the display when the program terminates, output list function optimization, add student function optimization 1.1
3 Modifications: Add sorting function, delete function internal optimization, main function internal change, adding student function optimization 1.2
4 Modifications: Add multi-subject input, adding function optimization, new total and average results display, sorting function optimization, output function change 1.3, update to this, continue to study (^_^)
5 Modifications: Add Save function, read function, main program modification, add list clear function 1.4 Modify: New modifier function, new macro definition Max_score and Max_sno, easy to modify the program, modify all warning in the program, some bug fix 1.5
#include
#include
#include
#include
#define BOOL INT
#define TRUE 1
#define LEN sizeof (struct RYB)
#define DATAFILE "datafile. WL "
#define Max_score 150
#define MAX_SNO 200
struct Ryb * DEL_ITEM_RYB (struct RYB * head,int sno,int * del_message);
struct Ryb * CREATE_ITEM_RYB (struct ryb * head);
void Put_ryb (struct ryb * head);
BOOL Is_sno (struct RYB * head, int sno);
False
struct RYB * Order (struct Ryb * head, enum ordertype type, int fs);
BOOL Save_data (struct RYB * head);
struct Ryb * read_data (void);
void Clear (struct ryb * head);
void Amend_ryb (struct ryb * head, int sno);
struct RYB {//define linked list data structure
int Sno; School Number
Char name[9]; Name
int Chinese; Chinese
int math; Mathematical
int 中文版; English
int clanguage; C language
int Tiyu; Sports
int score; Grade
struct RYB *next;
};
Enum ordertype{//defining Sort enumeration types
Asc,desc
};
int main (void)
{
struct Ryb * head,* temp_h;//linked list header, temporary linked list
BOOL exit = FALSE;
Short int value;//accepts input information 1,2,3,4 1 means add information, 2 display information, 3 delete information, 4 sort, 5 exit
int sno, Del_message = 0;//number, delete function processing result (1 for delete succeeded, 0 for delete failed)
int pxfs,pxlx;//Sort By, sort type (mode Asc\desc);(Type 1 School number, 2 results)
Char is_quit;//indicates whether to exit, Y or Y to exit, otherwise do not exit
Char is_save;//Indicates whether data is saved, Y or y means save, otherwise not saved
Char is_read;//indicates whether to read data, Y or Y to read, otherwise not read
BOOL ssave;//Indicates whether the save succeeds, True indicates success, false means save failed
int Amend_sno; Indicates the number of the study to be modified
Head = (struct Ryb *) malloc (LEN);//Create initial linked list
Head->sno =0;//Chain list Assignment initial value
Head->next = NULL;
Do
{
printf ("Blue Student management System v1.6 (c language version) \ n");
printf ("① add student \n② show score list \n③ Delete student \n④ sort \n⑤ Save data \n⑥ Read Data \n⑦ modify \n⑧ exit system \ n");
printf ("Wait for Command input:");
Fflush (stdin);//emptying the keyboard buffer
scanf ("%d", &value);
if (value = = 1)//Add
{
Head = Create_item_ryb (head);//Add information
printf ("Entry information End!\n");
System ("pause");
}else if (value = = 2)//Display
{
Put_ryb (head); Display information
System ("pause");
}
else if (value = = 3)//delete
{
printf ("Please enter the student number to delete:");
Fflush (stdin);//emptying the keyboard buffer
scanf ("%d", &sno);
Head = Del_item_ryb (Head,sno, &del_message); Delete
if (del_message = = 1)
{
printf ("Delete successful!!! \ n ");
}
Else
{
printf ("Delete failed!!! \ n ");
}
System ("pause");
}
else if (value = = 4)//Sort
{r:
printf ("Please enter the sorting method (1 Ascending, 2 descending):");
Fflush (stdin);
scanf ("%d", &PXFS);
printf ("Please enter the sort type (1 by school number, 2 by score):");
Fflush (stdin);
scanf ("%d", &PXLX);
if (Pxfs >2 | | pxfs <0 | | pxlx > 2 | | pxlx <0)
{
printf ("Sort or sort type input does not conform to the specified!!! Please re-enter!!! \ n ");
System ("pause");

Student Information System

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.