当前位置:网站首页>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 .
边栏推荐
- 【华为机试真题详解】判断字符串子序列【2022 Q1 Q2 | 200分】
- 基础:2.图像的本质
- 用C语言编程:用公式计算:e≈1+1/1!+1/2! …+1/n!,精度为10-6
- Leetcode t31: next spread
- 毕业论文中word的使用1-代码域标公式
- "Analysis of 43 cases of MATLAB neural network": Chapter 30 design of combined classifier based on random forest idea - breast cancer diagnosis
- The data analyst will be ruined without project experience. These 8 project resources will not be taken away
- Insert mathematical formula in MD document and mathematical formula in typora
- 挖财打新股安全吗
- SPL Introduction (I)
猜你喜欢

C语言指针的进阶(下)

嵌入式工程师面试题3-硬件

【华为机试真题详解】判断字符串子序列【2022 Q1 Q2 | 200分】

ARM v7的体系结构A、R、M区别,分别应用在什么领域?

FreeRTOS学习简易笔记

Centos7 shell script one click installation of JDK, Mongo, Kafka, FTP, PostgreSQL, PostGIS, pgrouting

MATLAB【函数和图像】

一文纵览主流 NFT 市场平台版税、服务费设计

Li Kou 1358 -- number of substrings containing all three characters (double pointer)

【MFC开发(17)】高级列表控件List Control
随机推荐
The use of word in graduation thesis
《MATLAB 神经网络43个案例分析》:第30章 基于随机森林思想的组合分类器设计——乳腺癌诊断
Internet of things technology is widely used to promote intelligent water automation management
Matlab tips (23) matrix analysis -- simulated annealing
Suivi des cibles de manoeuvre - - mise en oeuvre du modèle statistique actuel (modèle CS) filtre Kalman étendu / filtre Kalman sans trace par MATLAB
Matlab [function derivation]
Agrometeorological environment monitoring system
Redis源码学习(29),压缩列表学习,ziplist.c(二)
Principle and application of single chip microcomputer - off chip development
内存大小端
Advanced API
Yolov3, 4, 5 and 6 Summary of target detection
Configuration and startup of Chang'an chain synchronization node
Audio audiorecord create (I)
C语言指针的进阶(上篇)
Foundation: 3 Opencv getting started images and videos
基础:2.图像的本质
1.jetson与摄像头的对接
中考体育项目满分标准(深圳、安徽、湖北)
【MFC开发(16)】树形控件Tree Control