C language course design report - class performance management system
Need analysis:
The student performance management system has 13 functions. Make these 13 functions into 13 sub-functions. Design a menu in the main function to manage these 13 sub-numbers. to operate the entire system.
According to the requirements of the subject. Each student includes name (char), student number (char), and scores of M courses (float). In addition, the system functional requirements also require the information of each student to include total score and ranking. So it is natural to think of using a structure to define the information structure of each student. Then use a linked list to form an ordered whole. Use linked list operations to achieve unified management of all student information (score display, score sorting, score modification, etc.). Finally, in order to save it to the file in the order of processing in the future.
. Function of each function:
Outline design:
Module composition of the program:
Main function: int main() < /p>
New function: STUDENT *init()
Input function: STUDENT *create()
Display function: void print(STUDENT *head)
Delete function: STUDENT *delete(STUDENT *head)
Find function by name: void lookup(STUDENT *head)
Save function: void save(STUDENT *head)
Sort function by total score: STUDENT *sort(STUDENT *head)
Calculate total score and average function: void computer(STUDENT *h)
Modify function: STUDENT *Modify(STUDENT *head,STUDENT *new)
Sort function by student number: STUDENT *index(STUDENT *h)
Menu function: int menu_select()
The main functions of each function:
Input function: input data at any time.
Menu function: Display the system main menu.
Display function: Display the information of all students.
Search function: It is convenient for students to find their own grades.
Delete function: delete a student’s information.
Sort function: Sort by total score.
Sort function by student number: Sort by student number.
Insert function: New information can be inserted.
Save function: Save student scores to avoid loss.
Statistical functions:
l Displays the basic information of the students with the highest scores in each course.
l Displays the average grade for each course.
l Displays the number of students who exceeded the average grade for a course.
Division of functional modules of the topic:
Start
Menu interface
Function selection
Initialization function< /p>
Enter student information
Delete student information
Show student information
Find student information
Sort by grades< /p>
Save to file
Read data from file
Insert student scores
Category total
Exit the system
p>
End
Detailed design: In addition to the main function, the entire system also has 14 functions to implement eight major functions: input function, display function, search function, sorting function, insert function, and save Function, read function. The detailed design description of each function is as follows:
Main function main()
Use infinite loops for(;;) and switch() to implement the call of each function, and the system will numeric options to call the corresponding function.
Menu selection function int menu_select()
This is a parameterless function that mainly implements the "function selection" interface. In this interface, nine major functions of the system are displayed. According to Select the serial number in front of each function. After executing each function, return to the menu.
Code design: Initialization function STUDENT *init()
This is a parameterless function with only two statements in it. Its function is to initialize the linked list so that the value of head is NULL and a clear-screen statement.
For example: without this function, some garbled characters will be displayed when you execute the display function without entering any data!
Input record function STUDENT *create() This is a parameterless function used to input student performance records. When the student is @, the input stops. After the function ends, it brings back a pointer to the head of the linked list. Information pointing to the next student is inserted at the top of the table.
The N-S flow chart is as follows:
head=NULL unconditional loop
The pointer p points to the newly opened unit
Whether the pointer p is empty
Yes
Input student number p->num
Output p->num is @
Is the memory
Overflow input name p->name
Stop for(i=0;i<3;i++)
Input input score
Return p- >sum=s;
Menu p->average=(float)s/3;
Display record function void print(STUDENT *head)
This It is a parameterized function that does not return a value. The formal parameter is the "pointer to the head of the linked list". It is responsible for outputting all student score records. The disadvantage is that it cannot display student scores in pages.
Algorithm: First point the pointer of the p node to the first node, and output the data of the p node (i.e. the first node). Then point the pointer of the p node to the pointer of the p pointer (that is, the next node), and output the data of the p node (that is, the first node). Repeat this step until the p pointer points to NULL.
The N-S flow chart is as follows:
p=head, so that it points to the first node
Output the node pointed to by p
p points to the next node
When p does not refer to the end of the table
Program debugging:
Since many knowledge points in this topic have not been learned You have to look for it on your own in extracurricular materials. It is inevitable that errors of this kind will occur when using it. For example, the menu designed at the beginning is not as expected, but there is chaos in the entire window. The solution to this problem is to adjust. In the end, the teacher helped me find the problem - the number of times in the for loop exceeded the number of nodes in the linked list. Then when customizing the function, because the concept in the textbook was not clear, I wrote extra space keys, so that the function could not be called. Another example: when designing a password for modifying student information. When the user finds that he entered the password incorrectly and presses the backspace key, the "*" is not eliminated. As a result, the user presses the backspace key again, and the previous situation occurs again. Eventually the password is entered incorrectly. So the backspace key is used twice:
When operating the linked list, special attention should be paid to the movement of the linked list pointer (p=p->next) and the judgment of the end of the linked list (p= =NULL). Without pointer movement, an infinite loop can easily occur. It cannot be controlled during operation. So you will think it is a crash. If there is no judgment of the end of the linked list. Unexpected errors may occur during operation. For example: when displaying linked list information, garbled characters will appear later.
A system’s menus and prompts are very important. Without these users will not know how to use the system you designed. During the debugging process of the design, the debugging work cannot be completed smoothly. With a clear and simple menu and some prompt information, the debugging process was completed very smoothly.
The teachers and classmates who patiently answered my questions played a key role in the success of my mini program. After so many days and nights, and so many difficulties, the students worked diligently and down-to-earth, from start to finish. , did not show any fatigue, and was always enthusiastic. I am grateful for this atmosphere and the good conditions provided by the school.
Looking back on this course design, I still have a lot of emotions. Indeed, from getting the questions to completing the entire programming, from theory to practice, I can learn a lot in half a semester. Many things can not only consolidate the knowledge learned before, but also learn a lot of knowledge that has not been learned in books. Through this course design, I learned that it is very important to combine theory with practice. Only theoretical knowledge is far from enough. Only by combining the theoretical knowledge learned with practice and drawing conclusions from theory can we truly Serve the society, thereby improving your practical ability and independent thinking ability. Encountering problems during the design process can be said to be very difficult. After all, this is my first time doing it, so I will inevitably encounter various problems. At the same time, I discovered my own shortcomings during the design process. The knowledge I have learned before is not deep enough and my grasp is not firm enough, such as structures... After passing this course design, I must review the knowledge I have learned before.
This course design is over, and it has a great impact on me. I learned a lot through this practice. Learned to design a simple system. What aspects should be paid attention to. It also makes me know what aspects I have not done enough.
But I have summarized a little bit of experience as follows:
1. Make a detailed analysis of the system's functions and requirements, and reasonably decompose the tasks.
2. Give the decomposed subtasks to a relatively independent module.
3. Before designing a module, briefly imagine the display of the overall interface.
4. Write programs for the conceived interface.