当前位置:网站首页>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
边栏推荐
- [MySQL] MySQL million level data paging query method and its optimization
- Install the tp6.0 framework under windows, picture and text. Thinkphp6.0 installation tutorial
- uniCloud云开发获取小程序用户openid
- data = self._ data_ queue. get(timeout=timeout)
- 定位设置水平,垂直居中(多种方法)
- The best Chinese open source class of vision transformer, ten hours of on-site coding to play with the popular model of Vit!
- cartographer_ pose_ graph_ 2d
- Yunqi lab recommends experience scenarios this week, free cloud learning
- Supplementary course on basic knowledge of IM development (II): how to design a server-side storage architecture for a large number of image files?
- The wechat team disclosed that the wechat interface is stuck with a super bug "15..." The context of
猜你喜欢

11 IO frame
Technical past: tcp/ip protocol that has changed the world (precious pictures, caution for mobile phones)

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

【ARM】在NUC977上搭建基于boa的嵌入式web服务器

cartographer_ local_ trajectory_ builder_ 2d

PHP 2D / multidimensional arrays are sorted in ascending and descending order according to the specified key values

How does P2P technology reduce the bandwidth of live video by 75%?

Implementation of IM message delivery guarantee mechanism (II): ensure reliable delivery of offline messages

Anaconda creates tensorflow environment
Why does the mobile IM based on TCP still need to keep the heartbeat alive?
随机推荐
Procedural life
Daily production training report (16)
MySQL source code reading (II) login connection debugging
Positioning setting horizontal and vertical center (multiple methods)
Pytorch中自己所定义(修改)的模型加载所需部分预训练模型参数并冻结
Ribbon负载均衡服务调用
cartographer_ fast_ correlative_ scan_ matcher_ 2D branch and bound rough matching
基于SDN的DDoS攻击缓解
2021年OWASP-TOP10
Mongodb image configuration method
Chapter 9 setting up structured logging (I)
Red team scoring method statistics
thread priority
Serious hazard warning! Log4j execution vulnerability is exposed!
Using Jenkins to perform testng+selenium+jsup automated tests and generate extendreport test reports
As promised: Mars, the mobile terminal IM network layer cross platform component library used by wechat, has been officially open source
cartographer_optimization_problem_2d
DOM文档
Create SSH key pair configuration steps
How does P2P technology reduce the bandwidth of live video by 75%?