当前位置:网站首页>What management systems (Updates) for things like this
What management systems (Updates) for things like this
2022-06-26 05:28:00 【Elliot_ Alderson】
2019.7.12 Update record :
Many people come to roast that the code I wrote before is smelly and long , So today we updated the following , It really hasn't changed much , But there are many good reviews , I'm going to write back C++ Class version
No one is required to download , No one is required to give points , Direct disclosure , Sign in csdn Just copy and paste
codeblocks Replace the text shortcut key with :ctrl+R
Replace the text shortcut key with :ctrl+h
The source code is left here :
/*C++ Structure version , With notes */
/*
v0.3 Update log :2019.6.30 to update .
The main updates are :
1、 Put the original input part , The output part is changed to an inline function , Reduce code , Run faster
2、 The input and output contents only need to be changed in these two functions
3、 Try changing the next version to include class content
4、 Try changing the next version to windowed generated code , Just poke the mouse
5、 Actually, I didn't do much , But it's cool to write notes , Just write
~OuO~
*/
//VS Common shortcut key : Sequential press ctrl+k ctrl+d—— Automatic code formatting
//ctrl+h—— Quick replace text , If there is a selected part, only the selected part will be replaced by default , On the contrary, global replacement , Including comments will also be replaced
//Codeblocks Common shortcut key :alt+l Call out the menu , choice Astyle, Can automatically organize the code format
//ctrl+r—— Quick replace text , The effect same as above
#include<iostream>
#include<string>
#include<algorithm>
#define MAXN 1000// The maximum number of management objects can be stored
using namespace std;
int Count = 0;
struct Tem
{
char s1[30];
char s2[30];
char s3[30];
char s4[30];
char s5[30];
char s6[30];
char s7[30];
char s8[30];
char s9[30];
char s10[30];// Reserved ten character array
int int_num1;
int int_num2;
int int_num3;
int int_num4;
int int_num5;// Five integers reserved
double double_num1;
double double_num2;
double double_num3;
double double_num4;
double double_num5;// reserve 5 Decimals
int status;// Status flag ,0 For there is no such thing , Nonzero is negative
}tem[MAXN];
inline void insert(int index)// Input function
{
cout << " Please enter s1:" << endl;
cin >> tem[index].s1;
cout << " Please enter s2:" << endl;
cin >> tem[index].s2;
cout << " Please enter s3:" << endl;
cin >> tem[index].s3;
cout << " Please enter s4:" << endl;
cin >> tem[index].s4;
cout << " Please enter s5:" << endl;
cin >> tem[index].s5;
cout << " Please enter s6:" << endl;
cin >> tem[index].s6;
cout << " Please enter s7:" << endl;
cin >> tem[index].s7;
cout << " Please enter s8:" << endl;
cin >> tem[index].s8;
cout << " Please enter s9:" << endl;
cin >> tem[index].s9;
cout << " Please enter s10:" << endl;
cin >> tem[index].s10;
cout << " Please enter int_int_num1:" << endl;
cin >> tem[index].int_num1;
cout << " Please enter int_num2:" << endl;
cin >> tem[index].int_num2;
cout << " Please enter int_num3:" << endl;
cin >> tem[index].int_num3;
cout << " Please enter int_num4:" << endl;
cin >> tem[index].int_num4;
cout << " Please enter int_num5:" << endl;
cin >> tem[index].int_num5;
cout << " Please enter double_int_num1:" << endl;
cin >> tem[index].double_num1;
cout << " Please enter double_num2:" << endl;
cin >> tem[index].double_num2;
cout << " Please enter double_num3:" << endl;
cin >> tem[index].double_num3;
cout << " Please enter double_num4:" << endl;
cin >> tem[index].double_num4;
cout << " Please enter double_num5:" << endl;
cin >> tem[index].double_num5;
}
inline void output(int index)// Output function
{
cout << "s1:" << tem[index].s1 << endl;
cout << "s2:" << tem[index].s2 << endl;
cout << "s3:" << tem[index].s3 << endl;
cout << "s4:" << tem[index].s4 << endl;
cout << "s5:" << tem[index].s5 << endl;
cout << "s6:" << tem[index].s6 << endl;
cout << "s7:" << tem[index].s7 << endl;
cout << "s8:" << tem[index].s8 << endl;
cout << "s9:" << tem[index].s9 << endl;
cout << "s10:" << tem[index].s10 << endl;
cout << "int_num1:" << tem[index].int_num1 << endl;
cout << "int_num2:" << tem[index].int_num2 << endl;
cout << "int_num3:" << tem[index].int_num3 << endl;
cout << "int_num4:" << tem[index].int_num4 << endl;
cout << "int_num5:" << tem[index].int_num5 << endl;
cout << "double_num1:" << tem[index].double_num1 << endl;
cout << "double_num2:" << tem[index].double_num2 << endl;
cout << "double_num3:" << tem[index].double_num3 << endl;
cout << "double_num4:" << tem[index].double_num4 << endl;
cout << "double_num5:" << tem[index].double_num5 << endl;
}
void insert_function()// Add function
{
insert(Count);
tem[Count].status = 1;
Count++;
}
void find_function()// Lookup function
{
int flag = 0;
char Name[30];
cout << " Please enter yes s1:" << endl;
cin >> Name;
for (int i = 0; i < Count; i++)
{
if (strcmp(Name, tem[i].s1) == 0 && tem[i].status)
{
flag = 1;
output(i);
break;
}
}
if (!flag)
{
cout << " Check no one " << endl;
}
}
void del_function()// Delete function
{
int flag = 0;
char Name[30];
cout << " Please enter yes s1:" << endl;
cin >> Name;
for (int i = 0; i < Count; i++)
{
if (strcmp(Name, tem[i].s1) == 0 && tem[i].status)
{
flag = 1;
output(i);
tem[i].status = 0;
cout << " deleted " << endl;
break;
}
}
if (!flag)
{
cout << " Check no one " << endl;
}
}
void change_function()// Modify the function
{
int flag = 0;
char Name[30];
cout << " Please enter yes s1:" << endl;
cin >> Name;
for (int i = 0; i < Count; i++)
{
if (strcmp(Name, tem[i].s1) == 0 && tem[i].status)
{
flag = 1;
output(i);
insert(i);
break;
}
}
if (!flag)
{
cout << " Check no one " << endl;
}
}
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 read_function()// Read file function
{
FILE *fp = fopen("save.txt", "r");
if (fp == NULL)
{
fp = fopen("save.txt", "w+");
fclose(fp);
return;
}
Count = 0;
while (!feof(fp))
{
fread(&tem[Count++], sizeof(struct Tem), 1, fp);
}
fclose(fp);
}
int main()
{
read_function();
while (1)
{
cout << "\t\t\t\tXXXXXXXX Management system " << endl;
cout << "\t\t\t\t 1. increase XXXX Information " << endl;
cout << "\t\t\t\t 2. Delete XXXX Information " << endl;
cout << "\t\t\t\t 3. modify XXXX Information " << endl;
cout << "\t\t\t\t 4. Inquire about XXXX Information " << endl;
cout << "\t\t\t\t 5. Exit the system " << endl;
cout << " Please select :" << endl;
int i;
cin >> 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;
default:
save_function();
exit(0);
break;
}
}
return 0;
}
/*write by:Elliot Alderson*/
You can take it away if you like , Don't tell me if I can use something , Open new things from time to time
边栏推荐
- Red team scoring method statistics
- 线程优先级
- Official image acceleration
- Introduction to GUI programming to game practice (I)
- Consul服务注册与发现
- Fedora alicloud source
- skimage. morphology. medial_ axis
- Using Jenkins to perform testng+selenium+jsup automated tests and generate extendreport test reports
- [MySQL] MySQL million level data paging query method and its optimization
- The State Council issued a document to improve the application of identity authentication and electronic seals, and strengthen the construction of Digital Government
猜你喜欢
Using Jenkins to perform testng+selenium+jsup automated tests and generate extendreport test reports
国务院发文,完善身份认证、电子印章等应用,加强数字政府建设
使用Jenkins执行TestNg+Selenium+Jsoup自动化测试和生成ExtentReport测试报告
Why does the mobile IM based on TCP still need to keep the heartbeat alive?
Create SSH key pair configuration steps
The difference between get and post in small interview questions
11 IO frame
How to rewrite a pseudo static URL created by zenpart
localStorage浏览器本地储存,解决游客不登录的情况下限制提交表单次数。
Experience of reading the road to wealth and freedom
随机推荐
MySQL数据库-01数据库概述
uniCloud云开发获取小程序用户openid
【上采样方式-OpenCV插值】
Vie procédurale
Introduction to GUI programming to game practice (I)
ZigBee learning in simple terms Lecture 1
Sofa weekly | open source person - Yu Yu, QA this week, contributor this week
红队得分方法统计
数据存储:MySQL之InnoDB与MyISAM的区别
Leetcode114. 二叉树展开为链表
DOM文档
Daily production training report (16)
[upsampling method opencv interpolation]
Introduction to lcm32f037 series of MCU chip for motor
Setting pseudo static under fastadmin Apache
Apktool tool usage document
慢慢学JVM之缓存行和伪共享
二次bootloader关于boot28.asm应用的注意事项,28035的
Create SSH key pair configuration steps
data = self._ data_ queue. get(timeout=timeout)