当前位置:网站首页>C language student information management system
C language student information management system
2022-07-01 08:41:00 【Writing poetry by programming】
Source code is as follows :
// establish 5 classmate , Every student has information : Student number 、 class 、 full name 、 Gender 、C language achievement .
// Manage the information of these five students .
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <windows.h>
typedef struct LNode{
char number[20];// Student number
char depth[20];// class
char name[20];// full name
char sex[20];// Gender
double score; // achievement
}user;
user userx[100];
int usern;// Total number of users
// Show all users
void showalluser()
{
int i;
printf(" Show all users \n");
for(i=0;i<usern;i++)
{
printf(" Student number :%s full name :%s Gender :%s class :%s achievement :%lf\n",userx[i].number,userx[i].name,userx[i].sex,userx[i].depth ,userx[i].score);
}
return;
}
// Insert user
void insertuser()
{
int i;
usern=5;
printf(" Enter user information \n");
for(i=0;i<usern;i++)
{
printf(" Please enter the student number \n");
scanf("%s",&userx[i].number);
printf(" Please enter gender \n");
scanf("%s",&userx[i].sex);
printf(" Please enter a name \n");
scanf("%s",&userx[i].name);
printf(" Please enter class \n");
scanf("%s",&userx[i].depth);
printf(" Please enter c language achievement \n");
scanf("%lf",&userx[i].score);
printf(" Input succeeded \n");
}
}
// Average score
void getAvg()
{
double avg=0;
int i;
for(i=0;i<usern;i++)
{
avg+=userx[i].score;
}
avg=avg/usern;
printf(" average %lf\n",avg);
}
// Statistics on the number of men and women
void tongji()
{
int a=0;
int b=0;
int i;
for(i=0;i<usern;i++)
{
if(strcmp(userx[i].sex," male ")==0)
{
a++;
}
else
{
b++;
}
}
printf(" Number of boys %d Number of girls %d\n",a,b);
}
// The lowest score
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(" The lowest score \n");
printf(" Student number :%s full name :%s Gender :%s class :%s achievement :%lf\n",userx[index].number,userx[index].name,userx[index].sex,userx[index].depth ,userx[index].score);
}
// Administrator interface
void guanmian()
{
int n;
while(1)
{
printf(" Student information management system \n");
printf("################################################################################\n");
printf(" 1. Enter student information \n");
printf(" 2. Browse all information \n");
printf(" 3. Average score \n");
printf(" 4. Statistics on the number of men and women \n");
printf(" 5. Seek the lowest score \n");
printf(" 6. sign out \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(" sign out \n");
system("cls");
return;
default:
printf(" error message \n");
system("cls");
}
}
return ;
}
int main()
{
guanmian();
return 0;
}
This system is implemented by using a very simple structure array , Use structure array and switch Statement and various functions to operate . The code logic is simple and clear .
边栏推荐
- shardingSphere
- 2022 ordinary scaffolder (special type of construction work) examination question bank and the latest analysis of ordinary scaffolder (special type of construction work)
- 2022 Chinese cook (technician) simulation test and Chinese cook (technician) practice test video
- 5mo3 UHI HII HII 17mn4 19Mn6 executive standard
- 挖财打新股安全吗
- 《单片机原理及应用》—定时器、串行通信和中断系统
- 《单片机原理及应用》-片外拓展
- 基于Gazebo的无人机管道检测
- vscode自定义各个区域的颜色
- 《单片机原理与应用》——并行IO口原理
猜你喜欢

VSYNC+三重缓存机制+Choreographer

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

动态代理

Nacos - 服务发现

C basic knowledge review (Part 4 of 4)

Public network cluster intercom +gps visual tracking | help the logistics industry with intelligent management and scheduling

What is 1cr0.5mo (H) material? 1cr0.5mo (H) tensile yield strength

Field agricultural irrigation system

Model and view of QT

Li Kou 1358 -- number of substrings containing all three characters (double pointer)
随机推荐
基础:2.图像的本质
What is the material of 16mo3 steel plate? What is the difference between 16mo3 and Q345R?
【MFC开发(16)】树形控件Tree Control
Leetcode t29: divide two numbers
[JS reverse] MD5 encryption parameter cracking
《微机原理》——微处理器内部及外部结构
Internet of things technology is widely used to promote intelligent water automation management
AES简单介绍
【面试必刷101】链表
爬虫知识点总结
In depth learning training sample amplification and tag name modification
Principle and application of single chip microcomputer - off chip development
Advanced API
Nacos - 配置管理
Maneuvering target tracking -- current statistical model (CS model) extended Kalman filter / unscented Kalman filter matlab implementation
基础:3.opencv快速入门图像和视频
2022.2.15
Redis源码学习(29),压缩列表学习,ziplist.c(二)
嵌入式工程师面试-常问问题集
How to recruit Taobao anchor suitable for your own store