当前位置:网站首页>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 )
边栏推荐
- 【Unity Shader 消融效果_案例分享】
- C语言课设物业费管理系统(大作业)
- 10 golang operator
- Top 10 Free 3D modeling software for beginners in 2022
- To sort out the anomaly detection methods, just read this article!
- Teach you how to implement a deep learning framework
- Make Tiantou village sweet. Is Xianjing taro or cabbage the characteristic agricultural product of Tiantou Village
- 局域网监控软件有哪些功能
- C language course set up library information management system (big homework)
- Minio error correction code, construction and startup of distributed Minio cluster
猜你喜欢
随机推荐
Distributed lock implementation
ABP 学习解决方案中的项目以及依赖关系
IT服务管理(ITSM)在高等教育领域的应用
[ManageEngine Zhuohao] mobile terminal management solution, helping the digital transformation of Zhongzhou aviation industry
Tidb single machine simulation deployment production environment cluster (closed pit practice, personal test is effective)
async 与 await
Uniapp tree level selector
How did ManageEngine Zhuohao achieve the goal of being selected into Gartner Magic Quadrant for four consecutive years?
子类调用父类的同名方法和属性
讓田頭村變甜頭村的特色農產品是仙景芋還是白菜
Pychart configuring jupyter
Application of IT service management (ITSM) in Higher Education
【ManageEngine】如何实现网络自动化运维
C语言课设职工信息管理系统(大作业)
【ManageEngine】终端管理系统,助力华盛证券数字化转型
数据库产生死锁了请问一下有没有解决办法
SystemVerilog learning-06-class encapsulation
交换机配置软件具有的作用
【企业数据安全】升级备份策略 保障企业数据安全
JDBC database operation