当前位置:网站首页>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;
}
边栏推荐
- cartographer_optimization_problem_2d
- Recursively traverse directory structure and tree presentation
- 【ARM】讯为rk3568开发板buildroot添加桌面应用
- 数据存储:MySQL之InnoDB与MyISAM的区别
- 【活动推荐】云原生、产业互联网、低代码、Web3、元宇宙……哪个是 2022 年架构热点?...
- SOFA Weekly | 开源人—于雨、本周 QA、本周 Contributor
- Redis installation on Linux
- MySQL数据库-01数据库概述
- Secondary bootloader about boot28 Precautions for ASM application, 28035
- Fedora alicloud source
猜你喜欢
Sofa weekly | open source person - Yu Yu, QA this week, contributor this week
Briefly describe the pitfalls of mobile IM development: architecture design, communication protocol and client
11 IO frame
慢慢学JVM之缓存行和伪共享
Leetcode114. 二叉树展开为链表
Tp5.0 framework PDO connection MySQL error: too many connections solution
Leetcode513.找出树的左下角的值
LeetCode_ Binary search tree_ Simple_ 108. convert an ordered array to a binary search tree
A beginner's entry is enough: develop mobile IM from zero
Redis usage and memory optimization
随机推荐
cartographer_ backend_ constraint
数据存储:MySQL之InnoDB与MyISAM的区别
递归遍历目录结构和树状展现
Leetcode513. Find the value in the lower left corner of the tree
Setting pseudo static under fastadmin Apache
Technical past: tcp/ip protocol that has changed the world (precious pictures, caution for mobile phones)
Henkel database custom operator '~~‘
Data storage: the difference between MySQL InnoDB and MyISAM
vscode config
国务院发文,完善身份认证、电子印章等应用,加强数字政府建设
SDN based DDoS attack mitigation
Could not get unknown property ‘*‘ for SigningConfig container of type org. gradle. api. internal
Fedora alicloud source
Briefly describe the pitfalls of mobile IM development: architecture design, communication protocol and client
Procedural life
RIA想法
CMakeLists. txt Template
出色的学习能力,才是你唯一可持续的竞争优势
SOFA Weekly | 开源人—于雨、本周 QA、本周 Contributor
Chapter 9 setting up structured logging (I)