当前位置:网站首页>About XXX management system (version C)
About XXX management system (version C)
2022-06-26 05:29:00 【Elliot_ Alderson】
Because a lot of people didi I said only C++ and C# The management system is too cumbersome , I think so myself , So I put a C Of , No line is C++ Code , Probably for The loop will be there and C++ It's kind of the same , The rest are not .
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#define MAXN 1000// The maximum number of management objects can be stored
int Count = 0;
struct Tem
{
char department[30];
char lab_name[30];
char lab_admin_name[30];
char lab_admin_phonenumber[30];
char order_name[30];
char order_phonenumber[30];
char order_course[30];
char order_subject[30];
int order_id;
int lab_id;
int order_weektime;
int order_daytime;
int status;// Status flag ,0 For there is no such thing , Nonzero is negative
}tem[MAXN];
void insert(int index)// Input function
{
printf(" Please enter the Department :\n");
scanf("%s", &tem[index].department);
printf(" Please enter the laboratory name :\n");
scanf("%s", &tem[index].lab_name);
printf(" Please enter the administrator name :\n");
scanf("%s", &tem[index].lab_admin_name);
printf(" Please enter the administrator phone number :\n");
scanf("%s", &tem[index].lab_admin_phonenumber);
printf(" Please enter the name of the subscriber :\n");
scanf("%s", &tem[index].order_name);
printf(" Please enter the telephone number of the person making the appointment :\n");
scanf("%s", &tem[index].order_phonenumber);
printf(" Please enter a course appointment :\n");
scanf("%s", &tem[index].order_course);
printf(" Please enter the appointment major :\n");
scanf("%s", &tem[index].order_subject);
printf(" Please enter the appointment number :\n");
scanf("%d", &tem[index].order_id);
printf(" Please enter the lab number :\n");
scanf("%d", &tem[index].lab_id);
printf(" Please enter the appointment week :\n");
scanf("%d", &tem[index].order_weektime);
printf(" Please enter the appointment section :\n");
scanf("%d", &tem[index].order_daytime);
}
void output(int index)// Output function
{
printf(" departments :%s\n", tem[index].department);
printf(" Laboratory name :%s\n", tem[index].lab_name);
printf(" Administrator name :%s\n", tem[index].lab_admin_name);
printf(" Administrator phone :%s\n", tem[index].lab_admin_phonenumber);
printf(" Name of the person making the appointment :%s\n", tem[index].order_name);
printf(" Telephone number of the person making the appointment :%s\n", tem[index].order_phonenumber);
printf(" Book a course :%s\n", tem[index].order_course);
printf(" Make an appointment for a major :%s\n", tem[index].order_subject);
printf(" Appointment number :%d\n", tem[index].order_id);
printf(" Lab No :%d\n", tem[index].lab_id);
printf(" Appointment weeks :%d\n", tem[index].order_weektime);
printf(" Appointment session :%d\n", tem[index].order_daytime);
}
void insert_function()// Add function
{
insert(Count);
tem[Count].status = 1;
Count++;
}
void find_function()// Lookup function
{
int flag = 0;
int id;
printf(" Please enter the appointment number :\n");
scanf("%d", &id);
for (int i = 0; i < Count; i++)
{
if (tem[i].order_id == id)
{
flag = 1;
output(i);
break;
}
}
if (!flag)
{
printf(" There is no such item \n");
}
}
void del_function()// Delete function
{
int flag = 0;
int id;
printf(" Please enter the appointment number :\n");
scanf("%d", &id);
for (int i = 0; i < Count; i++)
{
if (tem[i].order_id == id)
{
flag = 1;
output(i);
tem[i].status = 0;
printf(" deleted \n");
break;
}
}
if (!flag)
{
printf(" There is no such item \n");
}
}
void change_function()// Modify the function
{
int flag = 0;
char Name[30];
printf(" Please enter the Department :\n");
scanf("%s", &Name);
for (int i = 0; i < Count; i++)
{
if (strcmp(Name, tem[i].department) == 0 && tem[i].status)
{
flag = 1;
output(i);
insert(i);
break;
}
}
if (!flag)
{
printf(" There is no such item \n");
}
}
void save_function()// Save file functions
{
FILE* fp = fopen("save.txt", "w+");
for (int i = 0; i < Count; i++)
{
if (tem[i].status)
{
fwrite(&tem[i], sizeof(struct Tem), 1, fp);
}
}
fclose(fp);
}
void show_function()// Display all appointment information
{
for (int i = 0; i < MAXN; i++)
{
if (tem[i].status)
{
printf("-----------------------\n");
output(i);
printf("-----------------------\n");
}
}
}
void statistics_function()
{
printf(" Please enter what information you want to make statistics based on .\n");
printf("1、 Professional name \n");
printf("2、 school \n");
int i;
scanf("%d", &i);
printf(" Please enter name \n");
char name[20];
scanf("%s", name);
int flag = 0;
int result = 0;
for (int i = 0; i < Count; i++)
{
if (strcmp(i == 1 ? tem[i].order_course : tem[i].department, name) == 0)
{
flag = 1;
result++;
}
}
if (!flag)
{
printf(" No such item found \n");
}
else
{
printf(" The total number of people in this project is :%d\n", result);
}
}
int main()
{
while (1)
{
printf("\t\t\t\t Open laboratory information management system \n");
printf("\t\t\t\t 1. Add laboratory information \n");
printf("\t\t\t\t 2. Delete Lab Information \n");
printf("\t\t\t\t 3. Modify laboratory information \n");
printf("\t\t\t\t 4. Query laboratory information \n");
printf("\t\t\t\t 5. Statistical laboratory information \n");
printf("\t\t\t\t 6. Display Lab Information \n");
printf("\t\t\t\t 0. Exit the system \n");
printf(" Please select :\n");
int i;
scanf("%d", &i);
switch (i)
{
case 1:
system("cls");
insert_function();
system("pause");
system("cls");
break;
case 2:
system("cls");
del_function();
system("pause");
system("cls");
break;
case 3:
system("cls");
change_function();
system("pause");
system("cls");
break;
case 4:
system("cls");
find_function();
system("pause");
system("cls");
break;
case 5:
system("cls");
statistics_function();
system("pause");
system("cls");
break;
case 6:
system("cls");
show_function();
system("pause");
system("cls");
break;
default:
save_function();
exit(0);
break;
}
}
return 0;
}
边栏推荐
- [arm] add desktop application for buildreoot of rk3568 development board
- C# 39. Conversion between string type and byte[] type (actual measurement)
- 售前分析
- Lesson 4 serial port and clock
- 写在父亲节前
- 线程优先级
- 红队得分方法统计
- Tp5.0框架 PDO连接mysql 报错:Too many connections 解决方法
- Redis installation on Linux
- There are applications related to web network request API in MATLAB (under update)
猜你喜欢
![C# 40. Byte[] to hexadecimal string](/img/3e/1b8b4e522b28eea4faca26b276a27b.png)
C# 40. Byte[] to hexadecimal string

百度API地图的标注不是居中显示,而是显示在左上角是怎么回事?已解决!

Recursively traverse directory structure and tree presentation

ECCV 2020 double champion team, take you to conquer target detection on the 7th

红队得分方法统计

Tp5.0框架 PDO连接mysql 报错:Too many connections 解决方法

Red team scoring method statistics

Introduction to GUI programming to game practice (I)

Ad tutorial series | 4 - creating an integration library file

uniCloud云开发获取小程序用户openid
随机推荐
Using Jenkins to perform testng+selenium+jsup automated tests and generate extendreport test reports
线程优先级
Consul服务注册与发现
How to rewrite a pseudo static URL created by zenpart
Red team scoring method statistics
【ARM】讯为rk3568开发板buildroot添加桌面应用
Setting pseudo static under fastadmin Apache
Introduction to lcm32f037 series of MCU chip for motor
Wechat team sharing: technical decryption behind wechat's 100 million daily real-time audio and video chats
Leetcode513. Find the value in the lower left corner of the tree
DOM文档
[PHP] PHP two-dimensional array is sorted by multiple fields
The best Chinese open source class of vision transformer, ten hours of on-site coding to play with the popular model of Vit!
cartographer_ fast_ correlative_ scan_ matcher_ 2D branch and bound rough matching
定位设置水平,垂直居中(多种方法)
Tp5.0 framework PDO connection MySQL error: too many connections solution
The State Council issued a document to improve the application of identity authentication and electronic seals, and strengthen the construction of Digital Government
cartographer_fast_correlative_scan_matcher_2d分支定界粗匹配
Serious hazard warning! Log4j execution vulnerability is exposed!
apktool 工具使用文档