关于C++课设————物流信息管理系统的源码
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
#define Max 1000
static int s = 0;//货物的总量
string zh = "1"; //设置进入的账号
char mima[7] = "123456"; //设置密码
void menu();
void pai();
void duqu()
{
ofstream outfile1("1.txt", ios::out);//初始化文件,清空存储的内容
if (!outfile1)
{
cout << "打开文件失败!" << endl;
exit(1);
}
outfile1.close();
string productname[Max];//物品名称
int productnum[Max];//物品编号
int num[Max];//物品的数量
string name[Max];//管理人名
string str1, str2;
cout << "是否初始化管理的货物" << endl;
cin >> str2;
if (str2 == "是")
{
ofstream outfile("1.txt", ios::out);
if (!outfile)
{
cerr << "打开失败" << endl;
exit(1);
}
for (int i = 0; i < Max; i++)
{
cout << "请输入要添加的物品的名称" << endl;
cin >> productname[s];
outfile << productname[s] << " ";
cout << "请输入要添加的物品的编号" << endl;
cin >> productnum[s];
outfile << productnum[s] << " ";
cout << "请输入要添加的物品的数量" << endl;
cin >> num[s];
outfile << num[s] << " ";
cout << "请输入要添加的物品的收货人" << endl;
cin >> name[s];
outfile << name[s] << " ";
s++;
cout << "是否继续添加" << endl;
cin >> str1;
if (str1 == "否")
{
break;
}
}
outfile.close();
}
}
void add()
{
string productname[Max];//物品名称
int productnum[Max];//物品编号
int num[Max];//物品的数量
string name[Max];//人名
ofstream outfile("1.txt", ios::app);
if (!outfile)
{
cerr << "打开失败" << endl;
exit(1);
}
cout << "请输入要添加的物品的名称" << endl;
cin >> productname[s];
outfile << productname[s] << " ";
cout << "请输入要添加的物品的编号" << endl;
cin >> productnum[s];
outfile << productnum[s] << " ";
cout << "请输入要添加的物品的数量" << endl;
cin >> num[s];
outfile << num[s] << " ";
cout << "请输入要添加的物品的管理人" << endl;
cin >> name[s];
outfile << name[s] << " ";
s++;
outfile.close();
menu();
}
void sera()
{
system("cls");
pai();
string productname[Max];//物品名称
int productnum[Max];//物品编号
int num[Max];//物品的数量
string name[Max];//人名
ifstream infile("1.txt", ios::in);
if (!infile)
{
cout << "打开文件失败" << endl;
exit(1);
}
cout << "物品名称 " << "物品编号 " << "物品的数量 "
<< "管理人" << endl;
for (int j = 0; j < s; j++)
{
infile >> productname[j];
cout << productname[j] << " ";
infile >> productnum[j];
cout << productnum[j] << " ";
infile >> num[j];
cout << num[j] << " ";
infile >> name[j];
cout << name[j] << endl;
}
infile.close();
menu();
}
void Delete()
{
system("cls");
int k;
string productname[Max];//物品名称
int productnum[Max];//物品编号
int num[Max];//物品的数量
string name[Max];//人名
ifstream infile("1.txt", ios::in);
if (!infile)
{
cout << "打开文件失败" << endl;
exit(1);
}
cout << "物品名称 " << "物品编号 " << "物品的数量 "
<< "管理人名" << endl;
for (int j = 0; j < s; j++)
{
infile >> productname[j];
cout << productname[j];
infile >> productnum[j];
cout << productnum[j] << " ";
infile >> num[j];
cout << num[j] << " ";
infile >> name[j];
cout << name[j] << " ";
cout << endl;
}
infile.close();
ofstream outfile("1.txt", ios::out);
if (!outfile)
{
cerr << "打开失败" << endl;
exit(1);
}
cout << "你想删除第几个" << endl;
cin >> k;
for (int i = 0; i < s; i++)
{
if (i != k - 1)
{
outfile << productname[i] << " ";
outfile << productnum[i] << " ";
outfile << num[i] << " ";
outfile << name[i] << " ";
}
}
s--;
outfile.close();
menu();
}
void gai()
{
system("cls");
string productname[Max];//物品名称
int productnum[Max];//物品编号
int num[Max];//物品的数量
string name[Max];//人名
int n1;
int z;
string productname1;
int productnum1;
int num1;
string name1;
ifstream infile("1.txt", ios::in);
if (!infile)
{
cerr << "打开失败" << endl;
exit(1);
}
cout << "物品名称 " << "物品编号 " << "物品的数量 "
<< "管理人名" << endl;
for (int k = 0; k < s; k++)
{
infile >> productname[k];
cout << productname[k] << " ";
infile >> productnum[k];
cout << productnum[k] << " ";
infile >> num[k];
cout << num[k] << " ";
infile >> name[k];
cout << name[k] << " ";
cout << endl;
}
infile.close();
cout << "请输入要修改第几个" << endl;
cin >> n1;
for (int i = 0; i <= s; i++)
{
if (n1 - 1 == i)
{
cout << "1.修改物品名称" << endl;
cout << "2.修改物品编码" << endl;
cout << "3.修改物品数量" << endl;
cout << "4.管理人名" << endl;
cout << "请输入序号" << endl;
cin >> z;
switch (z)
{
case 1: cout << "请输入要修改的物品的名字" << endl;
cin >> productname1;
productname[i] = productname1;
cout << "修改成功!" << endl;
break;
case 2: cout << "请输入要修改的物品的编码" << endl;
cin >> productnum1;
productnum[i] = productnum1;
cout << "修改成功!" << endl;
break;
case 3:cout << "请输入要修改的物品的数量" << endl;
cin >> num1;
num[i] = num1;
cout << "修改成功!" << endl;
break;
case 4:cout << "请输入修改的管理人的名字" << endl;
cin >> name1;
name[i] = name1;
cout << "修改成功!" << endl;
break;
default:
cout << "请输入标准的功能序号" << endl;
gai();
break;
}
break;
}
}
ofstream outfile("1.txt", ios::out);
if (!outfile)
{
cerr << "打开失败" << endl;
exit(1);
}
for (int j = 0; j < s; j++)
{
outfile << productname[j] << " ";
outfile << productnum[j] << " ";
outfile << num[j] << " ";
outfile << name[j] << " ";
}
outfile.close();
menu();
}
void menu()
{
int n;
bool b = true;
system("pause");
system("cls");
cout << "**********************" << endl;
cout << "*******功能序号*******" << endl;
cout << "1.查询货物的信息" << endl;
cout << "2.添加货物信息" << endl;//添加信息
cout << "3.删除货物信息" << endl;//删除信息
cout << "4.修改信息" << endl;
cout << "5.退出程序" << endl;
cout << "**********************" << endl;
do
{
cin >> n;
switch (n)
{
case 1: sera();
break;
case 2: add();
break;
case 3: Delete();
break;
case 4:gai();
break;
case 5: b = false;
exit(0);
break;
default:cout << "请输入标准的功能序号" << endl;
menu();
}
} while (b);
}
void login()
{
bool bol1 = true;
string zh1;
char mima1[7];
int i = 0;
cout << "********欢迎使用物流信息管理系统********" << endl;
cout << "****************************************" << endl;
cout << "******************登录******************" << endl;
cout << "*********账号:";
cin >> zh1;
cout << endl;
cout << "*********密码:";
cin >> mima1;
cout << endl;
if ((zh1 == zh && !strcmp(mima1, mima)))
{
cout << "****************登录成功!*****************" << endl;
system("pause");
system("cls");
cout << "请先建立文件" << endl;
duqu();
menu();
return;
}
else
{
cout << "****************登录失败!*****************" << endl;
cout << "****************请重新登录*****************" << endl;
login();
}
}
void pai() {
string productname[Max];//物品名称
int productnum[Max];//物品编号
int num[Max];//物品的数量
string name[Max];//人名
string productname1;
int productnum1;
int num1;
string name1;
ifstream infile("1.txt", ios::in);
if (!infile)
{
cout << "打开文件失败" << endl;
exit(1);
}
for (int j = 0; j < s; j++)
{
infile >> productname[j];
infile >> productnum[j];
infile >> num[j];
infile >> name[j];
}
infile.close();
for (int i = 0; i < s - 1; i++)
{
for (int k = i + 1; k < s; k++)
{
if (num[i] > num[k])
{
productname1 = productname[i];
productnum1 = productnum[i];
num1 = num[i];
name1 = name[i];
productname[i] = productname[k];
productnum[i] = productnum[k];
num[i] = num[k];
name[i] = name[k];
productname[i] = productname1;
productnum[k] = productnum1;
num[k] = num1;
name[k] = name1;
}
}
}
ofstream outfile("1.txt", ios::out);
if (!outfile)
{
cerr << "打开失败" << endl;
exit(1);
}
for (int t = 0; t < s; t++)
{
outfile << productname[t] << " ";
outfile << productnum[t] << " ";
outfile << num[t] << " ";
outfile << name[t] << " ";
}
outfile.close();
}
int main()
{
login();
return 0;
}
源码仅供参考!
关于C++课设————物流信息管理系统的源码相关推荐
- C语言物流信息管理系统实践,[源码和文档分享]基于C语言的物流配送管理信息系统...
一 需求分析 系统需要实现的功能如下: (一)各种基本数据的录入 配送路线基本信息录入 路线经停站点基本信息录入 站点经停车辆基本信息录入 其它信息录入 (二)各种基本数据的修改 即:允许对已经录入的 ...
- C语言课设-----工资管理系统(附全部源码)
C语言课设-----工资管理系统(附全部源码) 本系统分三个部分: 1.出售金鱼 2.数字菱形 3.工资管理系统 (ps:另外添加了登录界面 id:qwq password:123 可自己在代码里再更 ...
- 计算机毕业设计Java高校排课管理系统(源码+系统+mysql数据库+lw文档)
计算机毕业设计Java高校排课管理系统(源码+系统+mysql数据库+lw文档) 计算机毕业设计Java高校排课管理系统(源码+系统+mysql数据库+lw文档) 本源码技术栈: 项目架构:B/S架构 ...
- 计算机毕业设计Java疫情网课管理系统(源码+系统+mysql数据库+Lw文档)
计算机毕业设计Java疫情网课管理系统(源码+系统+mysql数据库+Lw文档) 计算机毕业设计Java疫情网课管理系统(源码+系统+mysql数据库+Lw文档) 本源码技术栈: 项目架构:B/S架构 ...
- JAVA计算机毕业设计银行贷款管理系统Mybatis+源码+数据库+lw文档+系统+调试部署
JAVA计算机毕业设计银行贷款管理系统Mybatis+源码+数据库+lw文档+系统+调试部署 JAVA计算机毕业设计银行贷款管理系统Mybatis+源码+数据库+lw文档+系统+调试部署 本源码技术栈 ...
- java毕业生设计贝儿米幼儿教育管理系统计算机源码+系统+mysql+调试部署+lw
java毕业生设计贝儿米幼儿教育管理系统计算机源码+系统+mysql+调试部署+lw java毕业生设计贝儿米幼儿教育管理系统计算机源码+系统+mysql+调试部署+lw 本源码技术栈: 项目架构:B ...
- java毕业设计教师工作量管理系统mybatis+源码+调试部署+系统+数据库+lw
java毕业设计教师工作量管理系统mybatis+源码+调试部署+系统+数据库+lw java毕业设计教师工作量管理系统mybatis+源码+调试部署+系统+数据库+lw 本源码技术栈: 项目架构:B ...
- java毕业生设计一中体育馆管理系统计算机源码+系统+mysql+调试部署+lw
java毕业生设计一中体育馆管理系统计算机源码+系统+mysql+调试部署+lw java毕业生设计一中体育馆管理系统计算机源码+系统+mysql+调试部署+lw 本源码技术栈: 项目架构:B/S架构 ...
- java毕业生设计药房药品采购集中管理系统计算机源码+系统+mysql+调试部署+lw
java毕业生设计药房药品采购集中管理系统计算机源码+系统+mysql+调试部署+lw java毕业生设计药房药品采购集中管理系统计算机源码+系统+mysql+调试部署+lw 本源码技术栈: 项目架构 ...
最新文章
- ASP.NET,IIS7.0 上传大视频文件报错
- 【Laravel】增加日志记录
- SHELL相关的特殊字符总结
- html让时间只展示年月日_如何用html写代码,使得在网页上显示当前的时间和日期...
- 大整数的因子(信息学奥赛一本通-T1171)
- Java基础语法学习11——流程控制(循环)
- apache通过rewrite限制某个目录
- ActivityGroup基本菜单
- 2021华为杯数学建模获奖经验分享
- VGG16网络结构与代码
- MD5加密 MD5加盐
- 电信 联通双线ip接入服务配置
- android10项目编译出错,android studio编译项目出错
- 新冠疫情加速医疗废物处置行业发展,我国医废处置能力达6245吨/天
- 教你用迅雷下载百度网盘的文件
- arctanx麦克劳林公式推导过程_【数学】「专题」初识泰勒级数(Taylor Series)与泰勒公式(Taylor#x27;s Formula)...
- java解惑之最后的笑声
- java反向查找dns_windows – 反向DNS查找
- 人工智能原理(书籍推荐)
- VB操作EXCEL方法汇总
热门文章
- RK3288 USB to Seria(PL2303)converter driver
- 【Unity】第13章 光照贴图和光影效果
- WHU校赛2019(网络赛) 解题报告(CCNU_你们好强啊我们都是面包手) Apare_xzc
- 31条指令单周期cpu设计(Verilog)-(七)整体代码结构
- eclipse开普勒_开普勒之路–里程碑3到来
- Mybatis-Plus的介绍和使用
- linux关闭timewait端口,linux 如何强制关闭 time_wait 连接
- 给excanvas添加fillText方法
- AnyTXT Searcher
- Mobile Edge Computing学习笔记(一)从通信领域看移动边缘计算:现有的经典结构与模型