当前位置:网站首页>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 )
边栏推荐
- FPGA - 7 Series FPGA internal structure clocking-01-clock Architecture Overview
- [enterprise data security] upgrade backup strategy to ensure enterprise data security
- 【自动化运维】自动化运维平台有什么用
- 子类调用父类的同名方法和属性
- 【ManageEngine】如何实现网络自动化运维
- [ManageEngine Zhuohao] helps Julia college, the world's top Conservatory of music, improve terminal security
- Teach you how to implement a deep learning framework
- HCM Beginner (II) - information type
- Using Baidu map to query national subway lines
- [ManageEngine] how to realize network automatic operation and maintenance
猜你喜欢

Application of IT service management (ITSM) in Higher Education

FPGA - 7 Series FPGA internal structure clocking-01-clock Architecture Overview

B-tree series

How did ManageEngine Zhuohao achieve the goal of being selected into Gartner Magic Quadrant for four consecutive years?

【自动化运维】自动化运维平台有什么用

【Unity Shader 消融效果_案例分享】

连续四年入选Gartner魔力象限,ManageEngine卓豪是如何做到的?

Discrimination between left and right limits of derivatives and left and right derivatives

Redis安装到Windows系统上的详细步骤

【ITSM】什么是ITSM,IT部门为什么需要ITSM
随机推荐
【LeetCode】Day91-存在重复元素
【网络安全工具】USB控制软件有什么用
10 golang operator
HCM Beginner (IV) - time
【企业数据安全】升级备份策略 保障企业数据安全
请求模块(requests)
虚幻 简单的屏幕雨滴后处理效果
【ManageEngine卓豪】移动终端管理解决方案,助力中州航空产业数字化转型
Self confidence is indispensable for technology
Excel visualization
【ManageEngine卓豪】助力黄石爱康医院实现智能批量化网络设备配置管理
SystemVerilog learning-07-class inheritance and package use
golang panic recover自定义异常处理
做技术,自信不可或缺
Diffusion (multi-source search)
[summary of knowledge points] chi square distribution, t distribution, F distribution
【ManageEngine卓豪】网络运维管理是什么,网络运维平台有什么用
[file system] how to run squashfs on UBI
High order binary balanced tree
C# ManualResetEvent 类的理解