当前位置:网站首页>C语言学生信息管理系统
C语言学生信息管理系统
2022-07-01 08:33:00 【用编程写诗】
源码如下:
//创建5位同学,每一位同学信息都有:学号、班级、姓名、性别、C语言成绩。
//对这五位同学的信息进行管理。
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <windows.h>
typedef struct LNode{
char number[20];//学号
char depth[20];//班级
char name[20];//姓名
char sex[20];//性别
double score; //成绩
}user;
user userx[100];
int usern;//全部的用户数目
//展示所有用户
void showalluser()
{
int i;
printf(" 展示所有用户 \n");
for(i=0;i<usern;i++)
{
printf("学号:%s 姓名:%s 性别:%s 班级:%s 成绩:%lf\n",userx[i].number,userx[i].name,userx[i].sex,userx[i].depth ,userx[i].score);
}
return;
}
//插入用户
void insertuser()
{
int i;
usern=5;
printf(" 录入用户信息 \n");
for(i=0;i<usern;i++)
{
printf(" 请输入学号 \n");
scanf("%s",&userx[i].number);
printf(" 请输入性别 \n");
scanf("%s",&userx[i].sex);
printf(" 请输入姓名 \n");
scanf("%s",&userx[i].name);
printf(" 请输入班级 \n");
scanf("%s",&userx[i].depth);
printf(" 请输入c语言成绩 \n");
scanf("%lf",&userx[i].score);
printf("录入成功\n");
}
}
//求平均分
void getAvg()
{
double avg=0;
int i;
for(i=0;i<usern;i++)
{
avg+=userx[i].score;
}
avg=avg/usern;
printf("平均分%lf\n",avg);
}
//统计男女人数
void tongji()
{
int a=0;
int b=0;
int i;
for(i=0;i<usern;i++)
{
if(strcmp(userx[i].sex,"男")==0)
{
a++;
}
else
{
b++;
}
}
printf("男生人数%d 女生人数%d\n",a,b);
}
//成绩最低
void getMin()
{
double min=userx[0].score;
int index=0;
int i;
for(i=0;i<usern;i++)
{
if(min>userx[i].score)
{
min=userx[i].score;
index=i;
}
}
printf("成绩最低\n");
printf("学号:%s 姓名:%s 性别:%s 班级:%s 成绩:%lf\n",userx[index].number,userx[index].name,userx[index].sex,userx[index].depth ,userx[index].score);
}
//管理员界面
void guanmian()
{
int n;
while(1)
{
printf(" 学生信息管理系统\n");
printf("################################################################################\n");
printf(" 1.录入学生信息 \n");
printf(" 2.所有信息浏览 \n");
printf(" 3.求平均分 \n");
printf(" 4.统计男女人数 \n");
printf(" 5.求成绩最低 \n");
printf(" 6.退出 \n");
printf("################################################################################\n");
scanf("%d",&n);
switch(n)
{
case 1:
insertuser();
break;
case 2:
showalluser();
break;
case 3:
getAvg();
break;
case 4:
tongji();
break;
case 5:
getMin();
break;
case 6:
printf(" 退出 \n");
system("cls");
return;
default:
printf("错误信息\n");
system("cls");
}
}
return ;
}
int main()
{
guanmian();
return 0;
}
这个系统是采用的很简单的结构体数组的方式来进行的,利用结构体数组和switch语句还有各个函数来进行的操作。代码逻辑很简单很明确。
边栏推荐
- Redis publish subscription
- 《微机原理》-绪论
- Stack implementation calculator
- 【无标题】
- shardingSphere
- 串口转WIFI模块通信
- There are many problems in sewage treatment, and the automatic control system of pump station is solved in this way
- 个人装修笔记
- Yolov3, 4, 5 and 6 Summary of target detection
- [deep analysis of C language] - data storage in memory
猜你喜欢

公网集群对讲+GPS可视追踪|助力物流行业智能化管理调度

What is the material of 16MnDR, the minimum service temperature of 16MnDR, and the chemical composition of 16MnDR

MAVROS发送自定义话题消息给PX4

Glitch Free时钟切换技术

TypeError: __init__() got an unexpected keyword argument ‘autocompletion‘

C语言指针的进阶(下)

Principle and application of single chip microcomputer - off chip development

MATLAB【函数和图像】

为什么LTD独立站就是Web3.0网站!

Gateway-88
随机推荐
V79.01 Hongmeng kernel source code analysis (user mode locking) | how to use the fast lock futex (Part 1) | hundreds of blogs analyze the openharmony source code
毕业论文中word的使用1-代码域标公式
2022 examination summary of quality controller civil engineering direction post skills (quality controller) and reexamination examination of quality controller civil engineering direction post skills
2022 mechanical fitter (primary) examination summary and mechanical fitter (primary) reexamination examination
【无标题】
爬虫知识点总结
Burpsuite -- brute force cracking of intruder
挖财打新股安全吗
What is the material of 16mo3 steel plate? What is the difference between 16mo3 and Q345R?
Intelligent constant pressure irrigation system
View drawing process analysis
避免按钮重复点击的小工具bimianchongfu.queren()
機動目標跟踪——當前統計模型(CS模型)擴展卡爾曼濾波/無迹卡爾曼濾波 matlab實現
个人装修笔记
Serial port to WiFi module communication
1.jetson与摄像头的对接
Provincial election + noi part I dynamic planning DP
Principle and application of single chip microcomputer - off chip development
Yolov5进阶之六目标追踪环境搭建
[deep analysis of C language] - data storage in memory