当前位置:网站首页>C language course design student information management system (big homework)
C language course design student information management system (big homework)
2022-07-01 06:26:00 【Ordinary senior】

One 、 Design function ( The article is for reference only )
1) The system works as a menu
2) Student information entry function ( Student information is saved in files )-- Input
3) Student information browsing function -- Output
4) Student information query function -- Algorithm
By student number
Search by name
5) Deletion and modification of student information ( optional )
Two 、 Function display




3、 ... and 、 Mind mapping




Four 、 Program source code
#include <stdio.h>
#include <string.h>
struct student// Structure type name
{
long int num;
char name[20];
int age;
char sex[4];
char b[30];
char p[15];
};
int n=0;
struct student stu[100];
struct student *p;// Point to student A pointer variable in
void lr();
void ll();
void cx();
void xg();
void sc();
int main()
{
int z;
printf("+---------------------------+\n");
printf("| Welcome to the student information management system |\n");
printf("+---------------------------+\n");
printf(" Tips : To ensure that your operation is saved , Please exit the system in the normal order ^_^\n");
do
{
printf("\n\t\t\t--------------------------------\n");
printf("\t\t\t+ The main menu |\n");
printf("\t\t\t--------------------------------\n");
printf("\t\t\t+ [1]---- Enter student information |\n");
printf("\t\t\t+ [2]---- Browse student information |\n");
printf("\t\t\t+ [3]---- Search for student information |\n");
printf("\t\t\t+ [4]---- Delete student information |\n");
printf("\t\t\t+ [5]---- Modify student information |\n");
printf("\t\t\t+ [0]---- Exit the system |\n");
printf("\t\t\t--------------------------------\n");
printf(" Please enter your choice :");
scanf("%d", &z);
switch(z)
{
case 0 : break;
case 1 :lr();break;
case 2 :ll();break;
case 3 :cx();break;
case 4 :sc();break;
case 5 :xg();break;
default:printf("\n invalid option !");
}
}
while(z!= 0);
}
void lr()/* Input function */
{
int y;
if(n==0)
p=stu;
do
{
printf("--------------------\n");
printf(" Please enter the student number :");
scanf("%ld",&p->num);
printf(" Please enter the student's name :");
scanf("%s",p->name);
printf(" Please enter the age of the student :");
scanf("%d",&p->age);
printf(" Please enter the gender of the student :");
scanf("%s",p->sex);
printf(" Please enter the student's address :");
scanf("%s",p->b);
printf(" Please enter the student's phone number :");
scanf("%s",p->p);
n++;
p++;
printf("\n1. Continue to input .\n0. Input complete .\n");
printf(" Please select :");
scanf("%d",&y);
}
while(y==1);
printf(" Tips : Input complete ! You have entered a total of %d individual \n",n);
}
void ll()/* Browse functions */
{
int i,j;
if(n!=0)
{
printf(" Total number of students :%d\n", n);
printf(" Student number \t full name \t Age \t Gender \t Address \t\t Telephone \n");
printf("-----------------------------------------------------\n");
for(i=0;i<n;i++)
printf("%ld\t%s\t%d\t%s\t%s\t\t%s\n",stu[i].num,stu[i].name,stu[i].age,stu[i].sex,stu[i].b,stu[i].p);
}
else printf(" Tips : No student data , Please input data !");
}
void cx()/* Query function */
{
int c;
int w,i,j=0;
char name[20];
if(n!=0)
{
do{
printf("\n");
printf("+--------------------+\n");
printf("| By student number Please press 1 |\n");
printf("| Search by name Please press 2 |\n");
printf("| Cancel Please press 0 |\n");
printf("+--------------------+\n");
printf(" Please enter your choice :");
scanf("%d", &c);
switch(c)
{
case 0:break;
case 1:
printf(" Please enter the student number ;");
scanf("%ld", &w);
printf("\n");
for(i=0;i<n;i++)
if(stu[i].num==w)
{
printf("\n Student number \t full name \t Age \t Gender \t Address \t\t Telephone \n");
printf("%ld\t%s\t%d\t%s\t%s\t\t%s\n",stu[i].num,stu[i].name,stu[i].age,stu[i].sex,stu[i].b,stu[i].p);
j=1;
}
if(j==0)
printf(" Tips : No student record , Please check !");
break;
case 2:
printf(" Please enter the student's name :");
scanf("%s", name);
printf("\n");
for(i=0;i<n;i++)
if(strcmp(name,stu[i].name)==0)
{
printf("\n Student number \t full name \t Age \t Gender \t Address \t\t Telephone \n");
j=1;
printf("%ld\t%s\t%d\t%s\t%s\t\t%s\n",stu[i].num,stu[i].name,stu[i].age,stu[i].sex,stu[i].b,stu[i].p);
}
if(j==0)
printf(" Tips : No student record , Please check !");
break;
default:
printf("\n Tips : invalid option !");
break;
}
}while(c!= 0);
}else printf(" Tips : No student data , Please input data !");
return;
}
void xg()/* Modify the function */
{
long int num;
int i,j,c;
if(n!=0)
{
printf(" Please enter the student number of the student you want to modify :");
scanf("%ld", &num);
printf("\n");
for(i=0;i<n;i++)
if(stu[i].num==num)
j=i;
do{
printf(" Please select the information content of the student you want to modify :\n");
printf("+----------------------+\n");
printf("| full name Please press 1 |\n");
printf("| Age Please press 2 |\n");
printf("| Gender Please press 3 |\n");
printf("| Student number Please press 4 |\n");
printf("| Address Please press 5 |\n");
printf("| Telephone Please press 6 |\n");
printf("| Cancel Please press 0 |\n");
printf("+----------------------+\n");
printf(" Please enter your choice :");
scanf("%d", &c);
printf("\n");
switch(c)
{
case 0:break;
case 1:printf(" Please enter a new name :");
scanf("%s",stu[j].name);
break;
case 2:printf(" Please enter a new age :");
scanf("%d",&stu[j].age);
break;
case 3:printf(" Please enter a new gender :");
scanf("%s",stu[j].sex);
break;
case 4:printf(" Please enter a new student number :");
scanf("%ld",&stu[j].num);
break;
case 5:printf(" Please enter a new address :");
scanf("%s",stu[j].b);
break;
case 6:printf(" Please enter a new phone number :");
scanf("%s",stu[j].p);
break;
default:
printf("\n invalid option !");
break;
}
}while(c!= 0);
}else printf(" Tips : No student data , Please input data !");
}
void sc()/* Delete function */
{
long int num;
int i,j,e;
if(n!=0)
{
printf(" Student number \t full name \t Age \t Gender \t Address \t\t Telephone \n");
printf("-----------------------------------------------------\n");
for(i=0;i<n;i++)
printf("%ld\t%s\t%d\t%s\t%s\t\t%s\n",stu[i].num,stu[i].name,stu[i].age,stu[i].sex,stu[i].b,stu[i].p);
printf(" Please enter the student number of the student you want to delete :");
scanf("%ld", &num);
printf("\n");
for(i=0;i<n;i++)
if(num==stu[i].num)
j=i;
if(j!=(n-1))
{
for(e=i-1;e<n;e++,j++)
{
stu[j].num=stu[j+1].num;
strcpy(stu[j].name,stu[j+1].name);
strcpy(stu[j].sex,stu[j+1].sex);
stu[j].age=stu[j+1].age;
strcpy(stu[j].b,stu[j+1].b);
strcpy(stu[j].p,stu[j+1].p);
n--;p--;
}
}else {
n--;p--;}
printf(" Tips : Delete completed !");
}else printf(" Tips : No student data , Please input data !");
}

You can pay attention to it, and it will be updated continuously in the future 0.0( Thank you first )
边栏推荐
- What are the functions of LAN monitoring software
- JDBC database operation
- [postgraduate entrance examination advanced mathematics Wu Zhongxiang +880 version for personal use] advanced mathematics Chapter II Basic Stage mind map
- Redis安装到Windows系统上的详细步骤
- Three minutes to quickly understand the whole process of website development
- 伪装请求头库: anti-useragent
- Discrimination between left and right limits of derivatives and left and right derivatives
- Comment imprimer le tableau original
- [file system] how to run squashfs on UBI
- Diffusion (multi-source search)
猜你喜欢
随机推荐
async 与 await
扩散(多源广搜)
分布式锁实现
make: g++:命令未找到
数据库产生死锁了请问一下有没有解决办法
Dongle data collection
High order binary search tree
JDBC connection pool
SystemVerilog learning-06-class encapsulation
Solve the problem of garbled files uploaded by Kirin v10
Projects and dependencies in ABP learning solutions
B-树系列
kubeadm搭建kubenetes 集群(个人学习版)
10-golang运算符
Flink practice -- multi stream merge
Pol8901 LVDS to Mipi DSI supports rotating image processing chip
ManageEngine Zhuohao helps you comply with ISO 20000 standard (IV)
讓田頭村變甜頭村的特色農產品是仙景芋還是白菜
10 golang operator
Although pycharm is marked with red in the run-time search path, it does not affect the execution of the program



![[summary of knowledge points] chi square distribution, t distribution, F distribution](/img/a6/bb5cabbfffb0edc9449c4c251354ae.png)





![[unity shader custom material panel part II]](/img/d1/8632ae680299a27b7431b2d6e03fd3.png)