Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use C language to realize the Project Management system of School Sports meeting

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to use C language to realize the school sports meeting project management system". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to use C language to achieve school sports meeting project management system"!

Source code # include # define N 3 / / number of colleges participating in the Games / / define a structure typedef struct project {char xiangmu [40]; / / name of the event char name [N] [40]; / / name of the college float score [N]; / / individual score int no [N]; / / single event ranking struct project * next / / pointer to the next node} Proj;typedef struct sumno {char name [40]; float sum;} SumNo;// function declaration is placed here void ListCreate (Proj * L, int n); / / create a linked list node void ListSearch (Proj * L); / / find a sports event information void ListModify (Proj * L); / / modify a sports event information void ListDelete (Proj * L) / delete a sports event information void Input (Proj * p, int I); / enter the sports event information void Output (Proj * L); / / output the college performance ranking information void PerRank (Proj * L) of each sports event; / / calculate the college performance ranking of each sports event and output void SumRank (Proj * L) / / the total score and ranking of each college in all events void Menu (); / / the menu of the school sports meeting project management system / / the main function entry of the school sports meeting project management system int main () {int item, n; / item is used to receive input commands, n to receive input items Proj * L = NULL / / initialize a header node L = (Proj *) malloc (sizeof (Proj)); / / Open up memory space for the header node L-> next = NULL; / / empty the pointer domain of the header node do {Menu (); / / menu printf ("Please enter the appropriate number and do the appropriate operation:\ n") Scanf ("% d", & item); system ("cls"); switch (item) {case 1: printf ("Please enter the number of items you want to enter:"); scanf ("% d", & n); ListCreate (L, n); / / create item list node getchar () Printf ("\ nPlease press any key to return to the main menu\ n"); getchar (); system ("cls"); break; case 2: ListSearch (L); / / find information about the project getchar (); printf ("\ nPlease press any key to return to the main menu\ n") Getchar (); system ("cls"); break; case 3: ListModify (L); / / modify project information getchar (); printf ("Please press any key to return to the main menu\ n"); getchar (); system ("cls"); break Case 4: ListDelete (L); / / delete project information getchar (); printf ("\ nPlease press any key to return to the main menu\ n"); getchar (); system ("cls"); break; case 5: PerRank (L) / / calculate the college performance ranking of each sports event Output (L); / / output the college performance ranking information of each sports event getchar (); printf ("\ nPlease press any key to return to the main menu\ n"); getchar (); system ("cls"); break Case 6: SumRank (L); / / Total score and ranking of each college for all programs getchar (); printf ("\ nPlease press any key to return to the main menu\ n"); getchar (); system ("cls"); break Case 0: printf ("about to quit the school sports meeting project management system."); / withdraw from the school sports meeting project management system exit (0); default: printf ("the instruction you entered is incorrect, please re-enter");} printf ("\ n\ n");} while (item); return 0 } / / create a linked list and insert the newly generated node into the header void ListCreate (Proj * L, int n) {int i; for (I = 0; I) of the linked list.

< n; i++) { Proj *p; //将新生成的节点插入到链表中 p = NULL; p = (Proj *)malloc(sizeof(Proj)); Input(p, i); p->

Next = L-> next; L-> next = p;}} / find project information void ListSearch (Proj * L) {int k; char n [40]; Proj * p = L-> next; if (p = = NULL) printf ("data is empty and cannot be found!") ; else {printf ("Please enter the name of the project you are looking for:"); scanf ("% s", n); while (strcmp (p-> xiangmu, n)! = 0) {p = p-> next; if (p = = NULL) {printf ("relevant information not found\ n") Return;}} PerRank (L); printf ("the relevant information about the project is as follows:\ n"); printf ("College name\ t single score\ t single ranking\ n\ n"); for (k = 0; k

< N; k++) { printf("%s\t\t", *((p->

Name) + k); printf ("% .2f\ t\ t", * ((p-> score) + k)); printf ("% d\ t\ n", * ((p-> no) + k));} printf ("\ n\ n");}} / / modify project related information void ListModify (Proj * L) {int item, k, a; char n [40], m [40] Proj * p = L-> next; if (p = = NULL) printf ("data is empty and cannot be modified!") ; else {printf ("Please enter the project name you want to modify:"); scanf ("% s", n); while (strcmp (p-> xiangmu, n)! = 0) {p = p-> next; if (p = = NULL) {printf ("relevant information not found\ n") Return;}} printf ("do you need to modify the project name (enter 1, not 0):"); scanf ("% d", & a); if (a = = 1) {printf ("Please enter your modified project name:"); scanf ("% s", m) Strcpy (p-> xiangmu, m); printf ("modified successfully!") ;} else if (a = = 0) {printf ("Please enter the college you want to modify:"); scanf ("% s", n); for (k = 0; k

< N; k++) { if (strcmp(*((p->

Name) + k), n) = 0) break;} printf ("Please enter the type of project information you want to modify:\ n"); printf ("1, the name of the college\ N2, the score of the college\ n"); scanf ("% d", & item) Switch (item) {case 1: printf ("Please enter the modified college name:"); scanf ("% s", m); strcpy (* ((p-> name) + k), m); printf ("modified successfully"); break Case 2: printf ("Please enter your revised grade for the program:"); scanf ("% f", (p-> score) + k); printf ("modified successfully"); break; default: printf ("you entered the wrong instruction!") Break;}} else printf ("you typed incorrectly!") ;}} / delete project related information void ListDelete (Proj * L) {char n [40]; Proj * p = L-> next, * pre = L; / / define the point of the p pointer to the header node, define the pre pointing to the header node, and the pre always points to the precursor node of p if (p = NULL) printf ("data is empty and cannot be deleted!") ; else {printf ("Please enter the project name you want to delete:"); scanf ("% s", n); while (strcmp (p-> xiangmu, n)! = 0) {pre = p; p = pre- > next If (p = = NULL) {printf ("No relevant information was found and cannot be deleted\ n"); return;}} pre- > next = p-> next; free (p); printf ("deleted successfully") }} / / calculate the college performance ranking of each sports event void PerRank (Proj * L) {int I, j, k; float t; char na [40] = {''}; Proj * p = L-> next; if (p = = NULL) printf ("data is empty, cannot be sorted!") ; else {while (p! = NULL) {for (I = 0; I)

< N; i++) { for (j = 0; j < N - i - 1; j++) { if (*((p->

Score) + j)

< *((p->

Score) + j + 1) {t = * ((p-> score) + j); * ((p-> score) + j) = * ((p-> score) + j + 1); * ((p-> score) + j + 1) = t Strcpy (na, * ((p-> name) + j)); strcpy (* ((p-> name) + j), * ((p-> name) + j + 1)); strcpy (* ((p-> name) + j + 1), na) } for (k = 0; k)

< N; k++) *((p->

No) + k) = k + 1; p = p-> next;}} / / Total scores and rankings of each school in all programs; void SumRank (Proj * L) {int I, j, k; float t; SumNo s [N], s0; Proj * p = L-> next; for (I = 0; I

< N; i++) { strcpy(s[i].name, *((p->

Name) + N-I-1); s [I] .sum = 0;} if (p = = NULL) printf ("data is empty!") ; else {while (p! = NULL) {for (iScore) + I); p = p-> next;} for (j = 0; j)

< N; j++) { for (k = 0; k < N - j - 1; k++) { if(s[k].sum>

S [k + 1] .sum) {s0 = s [k]; s [k] = s [KF1]; s [KF1] = s0;} p = L-> next; printf ("College name\ t total score\ t\ t overall ranking\ n") For (I = N-1; I > = 0; iMurt -) {printf ("% s\ t\ t", s [I] .name); printf ("% .2f\ t\ t", s [I] .sum); printf ("% d\ t\ t", N-I); printf ("\ n") Enter project related information void Input (Proj * p, int I) {int j; printf ("Please enter% d event name:", I + 1); scanf ("% s", p-> xiangmu); for (j = 0; j)

< N; j++) { printf("请输入第%d个学院的名称:", j + 1); scanf("%s", (p->

Name) + j); printf ("Please enter the school's scores for this program:"); scanf ("% f", (p-> score) + j);}} / / output all project information void Output (Proj * L) {int k; Proj * p = L-> next; while (p! = NULL) {printf ("\ t\ t Project:% s\ n\ n", p-> xiangmu) Printf ("College name\ t single score\ t single ranking\ n\ n"); for (k = 0; k

< N; k++) { printf("%s\t\t", *((p->

Name) + k); printf ("% .2f\ t\ t", * ((p-> score) + k)); printf ("% d\ t\ n", * ((p-> no) + k));} printf ("\ n\ n"); p = p-> next }} / / the menu of the school sports meeting project management system void Menu () {printf ("\ n\ n"); printf ("\ t\ t\ t = school sports project management system =\ n"); printf ("\ t\ t\ t * author: XXX class: artificial intelligence XXXX student number: XXXXXXXXX *\ n") Printf ("\ t\ t\ t *\ n"); printf ("\ t\ t\ t * 1 >. Enter sports event information *\ n "); printf ("\ t\ t\ t * 2 >. Find a sports event information *\ n "); printf ("\ t\ t\ t * 3 >. Modify a sports event information *\ n "); printf ("\ t\ t\ t * 4 >. Delete a sports meeting eye-catching message *\ n "); printf ("\ t\ t\ t * 5 >. Printf ("\ t\ t\ t * 6 >"). Total score and ranking of each college for all programs *\ n "); printf ("\ t\ t\ t * 0 >. Exit the management system *\ n "); printf ("\ t\ t\ t* Welcome to use this system! *\ n "); printf ("\ t\ t\ tkeeper =\ n ") Printf ("\ t\ t\ t enter options, press enter options:\ n");}

Screenshot of the main menu

At this point, I believe you have a deeper understanding of "how to use C language to realize the school sports meeting project management system". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report