#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
const int N=1000001;
using namespace std;
int tt=0;//用于存储本系统中管理员的人数,初始时管理员的人数为0
int ee=0;//存储资产种类的个数
int ss=0;//可领资产人员的数目
int rr=0;//登记表上记录的人数
int r2=0;//记录归还表上记录的人数
bool flag=false;//标记作用
map<string,int>A;
map<string,int>::iterator it;
void init()//在录入资产信息之前就定义好的固定资产的类别
{
A["办公设备"]=1;//大类
A["数码相机"]=1;
A["投影仪"]=1;
A["笔记本电脑"]=1;
A["台式机"]=1;
A["服务器"]=1;
A["传真机"]=2;//小类
A["复印机"]=2;
A["打印机"]=2;
A["其它"]=2;
}
//管理员类及其函数
class Manager//管理员类
{
public:
Manager()
{
mima="123456";//初始密码
}
string name;//只含有数字,字母组成的字符串
string mima;//管理员的密码
void denglu();//登录函数
void zhuce();//注册新管理员函数
void update();//修改密码函数
void Mshow();//用户管理,针对管理员
void Mdisplay();//显示
void Mupdate();//修改
void Madd();//添加
void Mdelete();//删除
void Msearch();//查询
} q[N]; //含有的管理员的人数上限
void Manager::Mshow()
{
cout<<"----用户管理-----"<<endl;
cout<<"1.添加人员信息"<<endl;
cout<<"2.修改人员信息"<<endl;
cout<<"3.查询人员信息"<<endl;
cout<<"4.删除人员信息"<<endl;
cout<<"5.显示已有人员信息"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择"<<endl;
}
void Manager::Mdelete()//删除人员信息
{
int se;
cout<<"请输入要删除人员的编号(编号从0开始)"<<endl;
cin>>se;
for(int j=se; j<tt-1; j++)
{
q[j]=q[j+1];
}
tt-=1;
}
void Manager::Msearch()//查询人员信息
{
int se;
cout<<"请输入要查询人员的编号(编号从0开始)"<<endl;
cin>>se;
cout<<"姓名为"<<q[se].name<<endl;
}
void Manager::Mdisplay()//显示人员信息
{
for(int i=0; i<tt; i++)
{
cout<<"姓名为"<<q[i].name<<endl;
}
}
void Manager::Mupdate()//修改人员信息
{
int se;
cout<<"请输入要修改人员的编号(编号从0开始)"<<endl;
cin>>se;
cout<<"请重新输入姓名"<<endl;
cin>>q[se].name;
}
void Manager::Madd()//增加人员信息
{
cout<<"请输入新增人员姓名"<<endl;
cin>>q[tt].name;
cout<<"请输入密码"<<endl;
cin>>q[tt].mima;
tt++;
}
void Manager::denglu()
{
string str,str2;
cout<<"请输入用户名"<<endl;
cin>>str;
int i;
for(i=0; i<tt; i++)//遍历查找
{
if(str==q[i].name)
{
cout<<"请输入密码"<<endl;
cin>>str2;
if(str2==q[i].mima)
{
flag=true;
cout<<"登录成功"<<endl;
}
else
{
cout<<"密码错误,请重新登陆"<<endl;
}
}
break;
}
if(i>=tt)
{
cout<<"不存在此用户名,请重新登陆"<<endl;
}
}
void Manager::zhuce()
{
string str;
int i;
cout<<"请输入合法的用户名,作为新注册管理员名"<<endl;
while(cin>>str)
{
for(i=0; i<tt; i++)
{
if(str==q[i].name)
{
cout<<"此用户名已经存在,请重新输入一个合法的用户名"<<endl;
break;
}
}
if(i>=tt)
{
q[tt].name=str;
cout<<"请输入一个合法的密码"<<endl;
cin>>q[tt++].mima;
cout<<"登录成功"<<endl;
flag=true;
break;
}
}
}
void Manager::update()
{
cout<<"请输入您所要修改密码的用户名"<<endl;
string str,str2;
cin>>str;
int i;
for(i=0; i<tt; i++)
{
if(q[i].name==str)
{
cout<<"请输入新密码"<<endl;
cin>>q[i].mima;
flag=true;
cout<<"修改密码成功,并成功登陆"<<endl;
break;
}
}
if(i>=tt)
{
cout<<"此用户名不存在,请重新登陆"<<endl;
}
}
//固定资产信息管理类及其函数
class Money//固定资产
{
public:
int bh;
string mc;//名称
int lb;//类别
string xh;//型号
double jz;//价值
string time;//购买时间
string zt;//状态(正常,维修,报废)
string use;//使用者(空,使用者)
string bz;//备注
void show();
void show11();
void show22();
void add();//增加类中设备
void delet();//删除类中设备
void sdisplay();//显示已有小类设备
void bdisplay();//显示已有大类设备
void xadd();//增加固定资产信息
void xupdate();//修改固定资产信息
void xdelet();//删除固定资产信息
void xdisplay();//显示固定资产信息
} p[N];
void Money::show()
{
cout<<"----固定资产信息管理----"<<endl;
cout<<"1.固定资产类别管理"<<endl;
cout<<"2.固定资产信息管理"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择:"<<endl;
}
void Money::show11()
{
cout<<"----固定资产类别管理-----"<<endl;
cout<<"1.添加资产设备"<<endl;
cout<<"2.删除资产设备"<<endl;
cout<<"3.显示已有小类设备"<<endl;
cout<<"4.显示已有大类设备"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择"<<endl;
}
void Money::show22()
{
cout<<"----固定资产信息管理-----"<<endl;
cout<<"1.添加固定资产信息"<<endl;
cout<<"2.删除固定资产信息"<<endl;
cout<<"3.修改固定资产信息"<<endl;
cout<<"4.显示固定资产信息"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择"<<endl;
}
void Money::add()//添加设备
{
int se;
bool B=false;
string str;
cout<<"请输入你要增加的设备名称"<<endl;
cin>>str;
cout<<"请输入你要增加的设备分类,1代表大类,2代表小类"<<endl;
cin>>se;
if(A[str])
{
cout<<"此类别已经存在,不需要重新添加"<<endl;
B=true;
}
if(B==false)
{
A[str]=se;
cout<<"添加类别成功"<<endl;
}
}
void Money::delet()//删除设备
{
bool B=false;
string str;
cout<<"请输入你要删除的设备名称"<<endl;
cin>>str;
if(A[str])
{
cout<<"删除成功"<<endl;
A[str]=0;
B=true;
}
if(B==false)
{
cout<<"此类别不存在"<<endl;
}
}
void Money::sdisplay()//显示已有小类设备
{
cout<<"目前所有小类清单"<<endl;
for(it=A.begin(); it!=A.end(); it++)
{
if(it->second==2)
{
cout<<it->first.data()<<endl;
}
}
}
void Money::bdisplay()//显示已有大类设备
{
cout<<"目前所有大类清单"<<endl;
for(it=A.begin(); it!=A.end(); it++)
{
if(it->second==1)
{
cout<<it->first.data()<<endl;
}
}
}
void Money::xadd()//增加固定资产信息
{
cout<<"增加固定资产信息"<<endl;
cout<<"编号为"<<ee<<endl;
p[ee].bh=ee;
cout<<"请输入名称"<<endl;
cin>>p[ee].mc;
cout<<"请输入类别"<<endl;
cin>>p[ee].lb;
if(A[p[ee].mc]==0)//添加新资产类别名称
A[p[ee].mc]=p[ee].lb;
cout<<"请输入资产信息"<<endl;
cin>>p[ee].xh;
cout<<"请输入资产价值"<<endl;
cin>>p[ee].jz;
cout<<"请输入资产的购买日期"<<endl;
cin>>p[ee].time;
cout<<"请输入资产的状态"<<endl;
cin>>p[ee].zt;
cout<<"请输入资产的使用者"<<endl;
cin>>p[ee].use;
cout<<"请输入资产的备注"<<endl;
cin>>p[ee++].bz;
}
void Money::xdelet()//删除固定资产信息
{
cout<<"通过编号来进行删除信息,请输入你要修改的编号(编号从0开始)"<<endl;
int se;
cin>>se;
if(se>=ee)
{
cout<<"输入编号有误"<<endl;
return ;
}
for(int i=se; i<ee-1; i++)
{
p[i]=p[i+1];
}
ee-=1;
cout<<"删除成功"<<endl;
}
void Money::xupdate()//修改固定资产信息
{
cout<<"通过编号来进行修改信息,请输入你要修改的编号(编号从0开始)"<<endl;
int se;
cin>>se;
if(se>=ee)
{
cout<<"输入编号有误"<<endl;
return ;
}
cout<<"请重新输入资产名称"<<endl;
cin>>p[se].mc;
cout<<"请重新输入类别"<<endl;
cin>>p[se].lb;
if(A[p[se].mc]==0)//添加新资产类别名称
A[p[se].mc]=p[se].lb;
cout<<"请重新输入资产型号"<<endl;
cin>>p[se].xh;
cout<<"请重新输入资产价值"<<endl;
cin>>p[se].jz;
cout<<"请重新输入资产购买时间"<<endl;
cin>>p[se].time;
cout<<"请重新输入资产状态"<<endl;
cin>>p[se].zt;
cout<<"请重新输入资产使用者"<<endl;
cin>>p[se].use;
cout<<"请重新输入资产备注"<<endl;
cin>>p[se].bz;
}
void Money::xdisplay()//显示固定资产信息
{
cout<<"已有固定资产信息"<<endl;
for(int i=0; i<ee; i++)
{
cout<<"资产的编号为"<<p[ee].bh<<endl;
cout<<"资产的名称为"<<p[ee].mc<<endl;
cout<<"资产的类别为"<<p[ee].lb<<endl;
cout<<"资产的型号为"<<p[ee].xh<<endl;
cout<<"资产的价值为"<<p[ee].jz<<endl;
cout<<"资产的购买日期为"<<p[ee].time<<endl;
cout<<"资产的状态为"<<p[ee].zt<<endl;
cout<<"资产的使用者为"<<p[ee].use<<endl;
cout<<"资产的备注为"<<p[ee].bz<<endl;
}
}
//人员信息类及其函数
class people:public Manager
{
public:
string zw;//职务
string bz;//备注,存储员工所属资产
int bh;//编号
void pshow();
void pdisplay();//显示
void pupdate();//修改
void padd();//添加
void pdelete();//删除
void psearch();//查询
} T[N];
class Fmoney//用于资产分配
{
public:
string djbh;//登记表的编号
int bh;//设备编号
string time;//领用时间
string gl;//管理员
string yt;//用途
string bz;//备注
people temp;//类对象,用于登记人员
void Fshow();
void LY();//领用函数
void GH();//归还函数
} Y[N],U[N]; //登记表,归还表
void people::pshow()
{
cout<<"----人员信息管理-----"<<endl;
cout<<"1.添加人员信息"<<endl;
cout<<"2.修改人员信息"<<endl;
cout<<"3.查询人员信息"<<endl;
cout<<"4.删除人员信息"<<endl;
cout<<"5.显示已有人员信息"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择"<<endl;
}
void people::pdelete()//删除人员信息
{
int i;
cout<<"请输入要删除人员的编号(编号从0开始)"<<endl;
cin>>i;
for(int j=i; j<ss-1; j++)
{
T[j]=T[j+1];
}
ss-=1;
}
void people::psearch()//查询人员信息
{
int i;
cout<<"请输入要查询人员的编号(编号从0开始)"<<endl;
cin>>i;
cout<<"姓名为"<<T[i].name<<endl;
cout<<"职务为"<<T[i].zw<<endl;
cout<<"备注为"<<T[i].bz<<endl;
}
void people::pdisplay()//显示人员信息
{
for(int i=0; i<ss; i++)
{
cout<<"编号为"<<T[i].bh<<endl;
cout<<"姓名为"<<T[i].name<<endl;
cout<<"职务为"<<T[i].zw<<endl;
cout<<"备注为"<<T[i].bz<<endl;
}
}
void people::pupdate()//修改人员信息
{
int se;
cout<<"请输入要修改人员的编号"<<endl;
cin>>se;
cout<<"请重新输入姓名"<<endl;
cin>>T[se].name;
cout<<"请重新输入职务"<<endl;
cin>>T[se].zw;
cout<<"请重新输入备注"<<endl;
cin>>T[se].bz;
}
void people::padd()//增加人员信息
{
cout<<"编号为"<<ss<<endl;
T[ss].bh=ss;
cout<<"请输入姓名"<<endl;
cin>>T[ss].name;
cout<<"请输入职务"<<endl;
cin>>T[ss].zw;
cout<<"请输入备注"<<endl;
cin>>T[ss].bz;
ss++;
}
void Showmain1()
{
cout<<"---------固定资产管理系统----------"<<endl;
cout<<"1.管理员登录"<<endl;
cout<<"2.退出系统"<<endl;
cout<<"请输入您的选择: "<<endl;
}
class Cmoney//用于资产处置
{
public:
void Cshow();
void tiaobo();//调拨
void bianmai();//变卖
void baofei();//报废
};
void Cmoney::baofei()
{
cout<<"请输入要报废资产的编号"<<endl;
int se;
cin>>se;
if(p[se].use=="空")
{
p[se].zt=="报废";
cout<<"报废成功"<<endl;
}
else cout<<"无法报废"<<endl;
}
void Cmoney::Cshow()
{
cout<<"----资产处置-----"<<endl;
cout<<"1.调拨"<<endl;
cout<<"2.变卖"<<endl;
cout<<"3.报废"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择:"<<endl;
}
void Cmoney::tiaobo()//资产的调拨
{
cout<<"请输入您要调拨的固定资产的编号"<<endl;
int se;
cin>>se;
cout<<"--请输入你要调拨的方式--"<<endl;
cout<<"1.通过变更资产使用人"<<endl;
cout<<"2.通过改变存放位置"<<endl;
cout<<"3.通过改变资产状态"<<endl;
cout<<"请输入您的选择: "<<endl;
int sele;
cin>>sele;
if(sele==1)
{
cout<<"请输入您要调拨资产的两个人的编号A与B,将资产A给B"<<endl;
int bh1,bh2;
cin>>bh1>>bh2;
T[bh2].bz=T[bh2].bz+T[bh1].bz;
T[bh1].bz="\0";
}
else if(sele==2)
{
cout<<"请输入您要改变资产存放的位置,如A与B互换"<<endl;
int se1,se2;
cin>>se1>>se2;
Money tt;
tt=p[se1];
p[se1]=p[se2];
p[se2]=tt;
}
else if(sele==3)
{
cout<<"请输入您要改变资产状态的编号"<<endl;
int se;
string str;
cin>>se;
cout<<"请输入您要改变资产状态的状态"<<endl;
cin>>str;
p[se].zt=str;
}
}
void Cmoney::bianmai()//变卖函数
{
cout<<"请输入变卖的资产的编号"<<endl;
int se;
cin>>se;
if(p[se].zt=="空")
{
for(int i=se; i<ee-1; i++)
{
p[i]=p[i+1];
}
ee-=1;
cout<<"变卖成功"<<endl;
}
else
{
cout<<"先归还此资产"<<endl;
p[se].use="空";
cout<<"请输入归还日期"<<endl;
cin>>U[r2].time;
cout<<"归还管理员为"<<Y[se].gl<<endl;
U[r2++].gl=Y[se].gl;
for(int j=se; j<rr-1; j++)
{
Y[j]=Y[j+1];
}
rr-=1;
for(int i=se; i<ee-1; i++)
{
p[i]=p[i+1];
}
ee-=1;
cout<<"变卖成功"<<endl;
}
}
void Fmoney::GH()
{
cout<<"请输入你要归还的资产编号"<<endl;
int se;
cin>>se;
if(se>=rr)
{
cout<<"你输入归还的资产编号错误"<<endl;
return ;
}
p[se].use="空";
cout<<"请输入归还日期"<<endl;
cin>>U[r2].time;
cout<<"归还管理员为"<<Y[se].gl<<endl;
U[r2++].gl=Y[se].gl;
for(int j=se; j<rr-1; j++)
{
Y[j]=Y[j+1];
}
rr-=1;
}
void Fmoney::LY()
{
int se;
bool se1=false;
cout<<"请输入已经登记人员的编号"<<endl;
cin>>se;
if(se>=ss)
{
cout<<"输入人员编号有误"<<endl;
return ;
}
cout<<"登记表的编号为"<<rr<<endl;
Y[rr].djbh=rr;
Y[rr].temp=T[se];
cout<<"请输入设备编号"<<endl;
cin>>Y[rr].bh;
if((p[Y[rr].bh].zt=="正常")&&(p[Y[rr].bh].use=="空"))
{
se1=true;
}
if(se1==false)
{
cout<<"此资产不能用"<<endl;
return ;
}
cout<<"请输入领用日期"<<endl;
cin>>Y[rr].time;
cout<<"请输入管理员编号"<<endl;
cin>>Y[rr].gl;
cout<<"请输入用途"<<endl;
cin>>Y[rr].yt;
cout<<"请输入备注"<<endl;
cin>>Y[rr++].bz;
}
void Fmoney::Fshow()
{
cout<<"----资产分配----"<<endl;
cout<<"1.领用"<<endl;
cout<<"2.归还"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择"<<endl;
}
void enter()
{
cout<<"-----登录页面-----"<<endl;
cout<<"1.直接登录"<<endl;
cout<<"2.注册新用户"<<endl;
cout<<"3.修改密码"<<endl;
cout<<"请输入您的选择: "<<endl;
flag=false;
int se;//选择
Manager TEMP;//暂时借助的对象
cin>>se;
if(se==1)
{
TEMP.denglu();//登录函数
}
else if(se==2)
{
TEMP.zhuce();//注册
}
else if(se==3)
{
TEMP.update();//修改密码
}
else
{
cout<<"输入错误,请重新输入"<<endl;
}
}
void SHOWMAIN()
{
cout<<"--------------固定资产管理系统-------------"<<endl;
cout<<"1.资产信息管理"<<endl;
cout<<"2.人员信息管理"<<endl;
cout<<"3.资产配置"<<endl;
cout<<"4.资产处置"<<endl;
cout<<"5.用户管理"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择:"<<endl;
}
void Guding()//固定资产管理系统函数
{
int SE;//选择
int ssee;//选择
int mssee;//选择
SHOWMAIN();//主菜单
while(cin>>SE)
{
if(SE==0)
{
cout<<"回到主菜单"<<endl;
break;
}
else if(SE==1)//资产信息管理
{
Money Tp;//暂时使用对象
Tp.show();
while(cin>>ssee)
{
if(ssee==0)
{
break;//返回上一级
}
else if(ssee==1)//对固定资产类别管理
{
Tp.show11();
while(cin>>mssee)
{
if(mssee==0)
{
break;//返回上一级
}
else if(mssee==1)//添加固定资产设备
{
Tp.add();
}
else if(mssee==2)//删除固定资产设备
{
Tp.delet();
}
else if(mssee==3)//显示已有小类设备
{
Tp.sdisplay();
}
else if(mssee==4)//显示已有大类设备
{
Tp.bdisplay();
}
Tp.show11();
}
}
else if(ssee==2)
{
Tp.show22();
while(cin>>mssee)
{
if(mssee==0)
{
break;//返回上一级
}
else if(mssee==1)//添加固定资产信息
{
Tp.xadd();
}
else if(mssee==2)//删除固定资产信息
{
Tp.xdelet();
}
else if(mssee==3)//修改固定资产信息
{
Tp.xupdate();
}
else if(mssee==4)//显示固定资产信息
{
Tp.xdisplay();
}
Tp.show11();
}
}
Tp.show();
}
}
else if(SE==2)//人员信息管理
{
people Tp;//暂时使用对象
Tp.pshow();
while(cin>>ssee)
{
if(ssee==0)
{
break;//返回上一级
}
switch(ssee)
{
case 1: Tp.padd(); break;//增加
case 2: Tp.pupdate(); break;//修改
case 3: Tp.psearch(); break;//查询
case 4: Tp.pdelete(); break;//删除
case 5: Tp.pdisplay(); break;//显示
default :cout<<"输入有误"<<endl;break;
}
Tp.pshow();
}
}
else if(SE==3)//资产配置
{
Fmoney Tp;//暂时使用对象
Tp.Fshow();
while(cin>>ssee)
{
if(ssee==0)
{
break;//返回上一级
}
switch(ssee)
{
case 1: Tp.LY(); break;//增加
case 2: Tp.GH(); break;//修改
default :cout<<"输入有误"<<endl;break;
}
Tp.Fshow();
}
}
else if(SE==4)//资产处置
{
Cmoney Tp;//暂时使用对象
Tp.Cshow();
while(cin>>ssee)
{
if(ssee==0)
{
break;//返回上一级
}
switch(ssee)
{
case 1: Tp.tiaobo(); break;//挑拨
case 2: Tp.bianmai(); break;//变卖
case 3: Tp.baofei(); break;//报废
default :cout<<"输入有误"<<endl;break;
}
Tp.Cshow();
}
}
else if(SE==5)//用户管理
{
Manager Tp;//暂时使用对象
Tp.Mshow();
while(cin>>ssee)
{
if(ssee==0)
{
break;//返回上一级
}
switch(ssee)
{
case 1: Tp.Madd(); break;//增加
case 2: Tp.Mupdate(); break;//修改
case 3: Tp.Msearch(); break;//查询
case 4: Tp.Mdelete(); break;//删除
case 5: Tp.Mdisplay(); break;//显示
default :cout<<"输入有误"<<endl;break;
}
Tp.Mshow();
}
}
SHOWMAIN();//主菜单
}
}
int main()
{
init();
int choose=0;
Showmain1();
cin>>choose;
while(1)
{
if(choose==1)
{
flag=false;
enter();//登录函数
if(flag)//登陆成功
{
Guding();//进入固定资产管理系统
}
}
else if(choose==2)
{
cout<<"是否退出系统,如果退出请输入数字1"<<endl;
int tempp=0;
cin>>tempp;
if(tempp==1)
{
cout<<"退出系统成功,欢迎再次使用"<<endl;
}
}
else
{
cout<<"输入错误,请重新输入"<<endl;
}
Showmain1();
cin>>choose;
}
return 0;
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
- 152.
- 153.
- 154.
- 155.
- 156.
- 157.
- 158.
- 159.
- 160.
- 161.
- 162.
- 163.
- 164.
- 165.
- 166.
- 167.
- 168.
- 169.
- 170.
- 171.
- 172.
- 173.
- 174.
- 175.
- 176.
- 177.
- 178.
- 179.
- 180.
- 181.
- 182.
- 183.
- 184.
- 185.
- 186.
- 187.
- 188.
- 189.
- 190.
- 191.
- 192.
- 193.
- 194.
- 195.
- 196.
- 197.
- 198.
- 199.
- 200.
- 201.
- 202.
- 203.
- 204.
- 205.
- 206.
- 207.
- 208.
- 209.
- 210.
- 211.
- 212.
- 213.
- 214.
- 215.
- 216.
- 217.
- 218.
- 219.
- 220.
- 221.
- 222.
- 223.
- 224.
- 225.
- 226.
- 227.
- 228.
- 229.
- 230.
- 231.
- 232.
- 233.
- 234.
- 235.
- 236.
- 237.
- 238.
- 239.
- 240.
- 241.
- 242.
- 243.
- 244.
- 245.
- 246.
- 247.
- 248.
- 249.
- 250.
- 251.
- 252.
- 253.
- 254.
- 255.
- 256.
- 257.
- 258.
- 259.
- 260.
- 261.
- 262.
- 263.
- 264.
- 265.
- 266.
- 267.
- 268.
- 269.
- 270.
- 271.
- 272.
- 273.
- 274.
- 275.
- 276.
- 277.
- 278.
- 279.
- 280.
- 281.
- 282.
- 283.
- 284.
- 285.
- 286.
- 287.
- 288.
- 289.
- 290.
- 291.
- 292.
- 293.
- 294.
- 295.
- 296.
- 297.
- 298.
- 299.
- 300.
- 301.
- 302.
- 303.
- 304.
- 305.
- 306.
- 307.
- 308.
- 309.
- 310.
- 311.
- 312.
- 313.
- 314.
- 315.
- 316.
- 317.
- 318.
- 319.
- 320.
- 321.
- 322.
- 323.
- 324.
- 325.
- 326.
- 327.
- 328.
- 329.
- 330.
- 331.
- 332.
- 333.
- 334.
- 335.
- 336.
- 337.
- 338.
- 339.
- 340.
- 341.
- 342.
- 343.
- 344.
- 345.
- 346.
- 347.
- 348.
- 349.
- 350.
- 351.
- 352.
- 353.
- 354.
- 355.
- 356.
- 357.
- 358.
- 359.
- 360.
- 361.
- 362.
- 363.
- 364.
- 365.
- 366.
- 367.
- 368.
- 369.
- 370.
- 371.
- 372.
- 373.
- 374.
- 375.
- 376.
- 377.
- 378.
- 379.
- 380.
- 381.
- 382.
- 383.
- 384.
- 385.
- 386.
- 387.
- 388.
- 389.
- 390.
- 391.
- 392.
- 393.
- 394.
- 395.
- 396.
- 397.
- 398.
- 399.
- 400.
- 401.
- 402.
- 403.
- 404.
- 405.
- 406.
- 407.
- 408.
- 409.
- 410.
- 411.
- 412.
- 413.
- 414.
- 415.
- 416.
- 417.
- 418.
- 419.
- 420.
- 421.
- 422.
- 423.
- 424.
- 425.
- 426.
- 427.
- 428.
- 429.
- 430.
- 431.
- 432.
- 433.
- 434.
- 435.
- 436.
- 437.
- 438.
- 439.
- 440.
- 441.
- 442.
- 443.
- 444.
- 445.
- 446.
- 447.
- 448.
- 449.
- 450.
- 451.
- 452.
- 453.
- 454.
- 455.
- 456.
- 457.
- 458.
- 459.
- 460.
- 461.
- 462.
- 463.
- 464.
- 465.
- 466.
- 467.
- 468.
- 469.
- 470.
- 471.
- 472.
- 473.
- 474.
- 475.
- 476.
- 477.
- 478.
- 479.
- 480.
- 481.
- 482.
- 483.
- 484.
- 485.
- 486.
- 487.
- 488.
- 489.
- 490.
- 491.
- 492.
- 493.
- 494.
- 495.
- 496.
- 497.
- 498.
- 499.
- 500.
- 501.
- 502.
- 503.
- 504.
- 505.
- 506.
- 507.
- 508.
- 509.
- 510.
- 511.
- 512.
- 513.
- 514.
- 515.
- 516.
- 517.
- 518.
- 519.
- 520.
- 521.
- 522.
- 523.
- 524.
- 525.
- 526.
- 527.
- 528.
- 529.
- 530.
- 531.
- 532.
- 533.
- 534.
- 535.
- 536.
- 537.
- 538.
- 539.
- 540.
- 541.
- 542.
- 543.
- 544.
- 545.
- 546.
- 547.
- 548.
- 549.
- 550.
- 551.
- 552.
- 553.
- 554.
- 555.
- 556.
- 557.
- 558.
- 559.
- 560.
- 561.
- 562.
- 563.
- 564.
- 565.
- 566.
- 567.
- 568.
- 569.
- 570.
- 571.
- 572.
- 573.
- 574.
- 575.
- 576.
- 577.
- 578.
- 579.
- 580.
- 581.
- 582.
- 583.
- 584.
- 585.
- 586.
- 587.
- 588.
- 589.
- 590.
- 591.
- 592.
- 593.
- 594.
- 595.
- 596.
- 597.
- 598.
- 599.
- 600.
- 601.
- 602.
- 603.
- 604.
- 605.
- 606.
- 607.
- 608.
- 609.
- 610.
- 611.
- 612.
- 613.
- 614.
- 615.
- 616.
- 617.
- 618.
- 619.
- 620.
- 621.
- 622.
- 623.
- 624.
- 625.
- 626.
- 627.
- 628.
- 629.
- 630.
- 631.
- 632.
- 633.
- 634.
- 635.
- 636.
- 637.
- 638.
- 639.
- 640.
- 641.
- 642.
- 643.
- 644.
- 645.
- 646.
- 647.
- 648.
- 649.
- 650.
- 651.
- 652.
- 653.
- 654.
- 655.
- 656.
- 657.
- 658.
- 659.
- 660.
- 661.
- 662.
- 663.
- 664.
- 665.
- 666.
- 667.
- 668.
- 669.
- 670.
- 671.
- 672.
- 673.
- 674.
- 675.
- 676.
- 677.
- 678.
- 679.
- 680.
- 681.
- 682.
- 683.
- 684.
- 685.
- 686.
- 687.
- 688.
- 689.
- 690.
- 691.
- 692.
- 693.
- 694.
- 695.
- 696.
- 697.
- 698.
- 699.
- 700.
- 701.
- 702.
- 703.
- 704.
- 705.
- 706.
- 707.
- 708.
- 709.
- 710.
- 711.
- 712.
- 713.
- 714.
- 715.
- 716.
- 717.
- 718.
- 719.
- 720.
- 721.
- 722.
- 723.
- 724.
- 725.
- 726.
- 727.
- 728.
- 729.
- 730.
- 731.
- 732.
- 733.
- 734.
- 735.
- 736.
- 737.
- 738.
- 739.
- 740.
- 741.
- 742.
- 743.
- 744.
- 745.
- 746.
- 747.
- 748.
- 749.
- 750.
- 751.
- 752.
- 753.
- 754.
- 755.
- 756.
- 757.
- 758.
- 759.
- 760.
- 761.
- 762.
- 763.
- 764.
- 765.
- 766.
- 767.
- 768.
- 769.
- 770.
- 771.
- 772.
- 773.
- 774.
- 775.
- 776.
- 777.
- 778.
- 779.
- 780.
- 781.
- 782.
- 783.
- 784.
- 785.
- 786.
- 787.
- 788.
- 789.
- 790.
- 791.
- 792.
- 793.
- 794.
- 795.
- 796.
- 797.
- 798.
- 799.
- 800.
- 801.
- 802.
- 803.
- 804.
- 805.
- 806.
- 807.
- 808.
- 809.
- 810.
- 811.
- 812.
- 813.
- 814.
- 815.
- 816.
- 817.
- 818.
- 819.
- 820.
- 821.
- 822.
- 823.
- 824.
- 825.
- 826.
- 827.
- 828.
- 829.
- 830.
- 831.
- 832.
- 833.
- 834.
- 835.
- 836.
- 837.
- 838.
- 839.
- 840.
- 841.
- 842.
- 843.
- 844.
- 845.
- 846.
- 847.
- 848.
- 849.
- 850.
- 851.
- 852.
- 853.
- 854.
- 855.
- 856.
- 857.
- 858.
- 859.
- 860.
- 861.
- 862.
- 863.
- 864.
- 865.
- 866.
- 867.
- 868.
- 869.
- 870.
- 871.
- 872.
- 873.
- 874.
- 875.
- 876.
- 877.
- 878.
- 879.
- 880.
- 881.
- 882.
- 883.
- 884.
- 885.
- 886.
- 887.
- 888.
- 889.
- 890.
- 891.
- 892.
- 893.
- 894.
- 895.
View Code
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <queue>
const int N=1000001;
using namespace std;
int ss=0;//可领资产人员的数目
int rr=0;//登记表上记录的人数
int r2=0;//记录归还表上记录的人数
bool flag=false;//标记作用
bool ZZ=false,SE22=true;
static int countt=0;//管理人员编号
static int count2=0;//固定资产编号
map<string,int>A;
map<string,int>::iterator it;
void init()//在录入资产信息之前就定义好的固定资产的类别
{
A["办公设备"]=1;//大类
A["数码相机"]=1;
A["投影仪"]=1;
A["笔记本电脑"]=1;
A["台式机"]=1;
A["服务器"]=1;
A["传真机"]=2;//小类
A["复印机"]=2;
A["打印机"]=2;
A["其它"]=2;
}
//管理员类及其函数
class Manager//管理员类
{
public:
Manager()
{
mima="123456";//初始密码
}
string name;//只含有数字,字母组成的字符串
string mima;//管理员的密码
int bh;
class Manager *next;
void denglu();//登录函数
void zhuce();//注册新管理员函数
void update();//修改密码函数
void Mshow();//用户管理,针对管理员
void Mdisplay();//显示
void Mupdate();//修改
void Madd();//添加
void Mdelete();//删除
void Msearch();//查询
}; //含有的管理员的人数上限
class Manager *head=new Manager;
void Manager::Mshow()
{
cout<<"----用户管理-----"<<endl;
cout<<"1.添加人员信息"<<endl;
cout<<"2.修改人员信息"<<endl;
cout<<"3.查询人员信息"<<endl;
cout<<"4.删除人员信息"<<endl;
cout<<"5.显示已有人员信息"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择"<<endl;
}
void Manager::Mdelete()//删除人员信息
{
string str;
cout<<"请输入要删除用户名"<<endl;
cin>>str;
class Manager *tail,*pp;
for(pp=head,tail=head->next; tail!=NULL; tail=tail->next,pp=pp->next)
{
if(tail->name==str)
{
pp->next=tail->next;
delete tail;
break;
}
}
}
void Manager::Msearch()//查询人员信息
{
string str;
cout<<"请输入要查询人员的用户名"<<endl;
cin>>str;
class Manager *tail;
for(tail=head->next; tail!=NULL; tail=tail->next)
{
if(tail->name==str)
{
cout<<"编号为"<<tail->bh<<endl;
cout<<"用户名为"<<str<<endl;
return ;
}
}
cout<<"此用户名不存在"<<endl;
}
void Manager::Mdisplay()//显示人员信息
{
class Manager *tail;
for(tail=head->next; tail!=NULL; tail=tail->next)
{
cout<<"用户名为"<<tail->name<<endl;
}
}
void Manager::Mupdate()//修改人员信息
{
string se;
cout<<"请输入要修改人员的用户名"<<endl;
cin>>se;
class Manager *tail;
for(tail=head->next; tail!=NULL; tail=tail->next)
{
if(tail->name==se)
{
cout<<"请重新输入用户名"<<endl;
cin>>tail->name;
return ;
}
}
cout<<"此用户名不存在"<<endl;
}
void Manager::Madd()//增加人员信息
{
class Manager *qq;
qq=new Manager;
qq->next=NULL;
cout<<"请输入新增人员用户名"<<endl;
cin>>qq->name;
cout<<"请输入密码"<<endl;
cin>>qq->mima;
cout<<"编号为"<<countt<<endl;
qq->bh=countt++;
qq->next=head->next;
head->next=qq;
}
void Manager::denglu()
{
string str,str2;
if(ZZ==false)
{
ZZ=true;
head->next=NULL;
}
cout<<"请输入用户名"<<endl;
cin>>str;
class Manager *tail;
for(tail=head->next; tail!=NULL; tail=tail->next)
{
if(tail->name==str)
{
cout<<"请输入密码"<<endl;
cin>>str2;
if(str2==tail->mima)
{
flag=true;
cout<<"登录成功"<<endl;
}
else
{
cout<<"密码错误,请重新登陆"<<endl;
}
return ;
}
}
cout<<"不存在此用户名,请重新登陆"<<endl;
}
void Manager::zhuce()
{
string str;
cout<<"请输入合法的用户名,作为新注册管理员名"<<endl;
if(ZZ==false)
{
ZZ=true;
head->next=NULL;
}
class Manager *tail,*qq;
bool RRR=true;
while(cin>>str)
{
for(tail=head->next; tail!=NULL; tail=tail->next)
{
if(str==tail->name)
{
cout<<"此用户名已经存在,请重新输入一个合法的用户名"<<endl;
RRR=false;
break;
}
}
if(RRR)
{
flag=true;
qq=new Manager;
qq->next=NULL;
qq->name=str;
cout<<"请输入密码"<<endl;
cin>>qq->mima;
cout<<"编号为"<<countt<<endl;
qq->bh=countt++;
qq->next=head->next;
head->next=qq;
break;
}
RRR=true;
}
}
void Manager::update()
{
cout<<"请输入您所要修改密码的用户名"<<endl;
if(ZZ==false)
{
ZZ=true;
head->next=NULL;
}
string str,str2;
cin>>str;
class Manager *tail;
for(tail=head->next; tail!=NULL; tail=tail->next)
{
if(tail->name==str)
{
cout<<"请输入新密码"<<endl;
cin>>tail->mima;
flag=true;
cout<<"修改密码成功,并成功登陆"<<endl;
return ;
}
}
cout<<"此用户名不存在,请重新登陆"<<endl;
}
//固定资产信息管理类及其函数
class Money//固定资产
{
public:
int bh;
string mc;//名称
int lb;//类别
string xh;//型号
double jz;//价值
string time;//购买时间
string zt;//状态(正常,维修,报废)
string use;//使用者(空,使用中)
string bz;//备注
void show();
void show11();
void show22();
class Money *next;
void add();//增加类中设备
void delet();//删除类中设备
void sdisplay();//显示已有小类设备
void bdisplay();//显示已有大类设备
void xadd();//增加固定资产信息
void xupdate();//修改固定资产信息
void xdelet();//删除固定资产信息
void xdisplay();//显示固定资产信息
};
class Money *head1=new Money;
void Money::show()
{
cout<<"----固定资产信息管理----"<<endl;
cout<<"1.固定资产类别管理"<<endl;
cout<<"2.固定资产信息管理"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择:"<<endl;
}
void Money::show11()
{
cout<<"----固定资产类别管理-----"<<endl;
cout<<"1.添加资产设备"<<endl;
cout<<"2.删除资产设备"<<endl;
cout<<"3.显示已有小类设备"<<endl;
cout<<"4.显示已有大类设备"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择"<<endl;
}
void Money::show22()
{
cout<<"----固定资产信息管理-----"<<endl;
cout<<"1.添加固定资产信息"<<endl;
cout<<"2.删除固定资产信息"<<endl;
cout<<"3.修改固定资产信息"<<endl;
cout<<"4.显示固定资产信息"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择"<<endl;
}
void Money::add()//添加设备
{
int se;
bool B=false;
string str;
cout<<"请输入你要增加的设备名称"<<endl;
cin>>str;
cout<<"请输入你要增加的设备分类,1代表大类,2代表小类"<<endl;
cin>>se;
if(A[str])
{
cout<<"此类别已经存在,不需要重新添加"<<endl;
B=true;
}
if(B==false)
{
A[str]=se;
cout<<"添加类别成功"<<endl;
}
}
void Money::delet()//删除设备
{
bool B=false;
string str;
cout<<"请输入你要删除的设备名称"<<endl;
cin>>str;
if(A[str])
{
cout<<"删除成功"<<endl;
A[str]=0;
B=true;
}
if(B==false)
{
cout<<"此类别不存在"<<endl;
}
}
void Money::sdisplay()//显示已有小类设备
{
cout<<"目前所有小类清单"<<endl;
for(it=A.begin(); it!=A.end(); it++)
{
if(it->second==2)
{
cout<<it->first.data()<<endl;
}
}
}
void Money::bdisplay()//显示已有大类设备
{
cout<<"目前所有大类清单"<<endl;
for(it=A.begin(); it!=A.end(); it++)
{
if(it->second==1)
{
cout<<it->first.data()<<endl;
}
}
}
void Money::xadd()//增加固定资产信息
{
class Money *ppp;
ppp=new Money;
cout<<"增加固定资产信息"<<endl;
cout<<"编号为"<<count2<<endl;
ppp->bh=count2++;
cout<<"请输入名称"<<endl;
cin>>ppp->mc;
cout<<"请输入类别(1代表大类,2代表小类)"<<endl;
cin>>ppp->lb;
if(A[ppp->mc]==0)//添加新资产类别名称
A[ppp->mc]=ppp->lb;
cout<<"请输入资产型号"<<endl;
cin>>ppp->xh;
cout<<"请输入资产价值"<<endl;
cin>>ppp->jz;
cout<<"请输入资产的购买日期(形式如2008-08-08)"<<endl;
cin>>ppp->time;
cout<<"请输入资产的状态(状态分为:正常、维修、报废)"<<endl;
cin>>ppp->zt;
cout<<"请输入资产的使用者(空,使用中)"<<endl;
cin>>ppp->use;
cout<<"请输入资产的备注"<<endl;
cin>>ppp->bz;
ppp->next=head1->next;
head1->next=ppp;
}
void Money::xdelet()//删除固定资产信息
{
cout<<"通过编号来进行删除信息,请输入你要修改的编号(编号从0开始)"<<endl;
int se;
cin>>se;
class Money *ppp,*tail;
for(tail=head1,ppp=head1->next; ppp!=NULL; ppp=ppp->next,tail=tail->next)
{
if(ppp->bh==se)
{
tail->next=ppp->next;
ppp->next=NULL;
delete ppp;
cout<<"删除成功"<<endl;
return ;
}
}
cout<<"不存在此编号"<<endl;
}
void Money::xupdate()//修改固定资产信息
{
cout<<"通过编号来进行修改信息,请输入你要修改的编号(编号从0开始)"<<endl;
int se;
cin>>se;
class Money *ppp;
for(ppp=head1->next; ppp!=NULL; ppp=ppp->next)
{
if(ppp->bh==se)
{
cout<<"请重新输入名称"<<endl;
cin>>ppp->mc;
cout<<"请重新输入类别(1代表大类,2代表小类)"<<endl;
cin>>ppp->lb;
if(A[ppp->mc]==0)//添加新资产类别名称
A[ppp->mc]=ppp->lb;
cout<<"请重新输入资产型号"<<endl;
cin>>ppp->xh;
cout<<"请重新输入资产价值"<<endl;
cin>>ppp->jz;
cout<<"请重新输入资产的购买日期(形式如2008-08-08)"<<endl;
cin>>ppp->time;
cout<<"请重新输入资产的状态(状态分为:正常、维修、报废)"<<endl;
cin>>ppp->zt;
cout<<"请重新输入资产的使用者(空,使用中)"<<endl;
cin>>ppp->use;
cout<<"请重新输入资产的备注"<<endl;
cin>>ppp->bz;
cout<<"修改成功"<<endl;
return ;
}
}
cout<<"不存在此编号"<<endl;
}
void Money::xdisplay()//显示固定资产信息
{
cout<<"已有固定资产信息"<<endl;
class Money *tail;
for(tail=head1->next; tail!=NULL; tail=tail->next)
{
cout<<"资产的编号为"<<tail->bh<<endl;
cout<<"资产的名称为"<<tail->mc<<endl;
cout<<"资产的类别为"<<tail->lb<<endl;
cout<<"资产的型号为"<<tail->xh<<endl;
cout<<"资产的价值为"<<tail->jz<<endl;
cout<<"资产的购买日期为"<<tail->time<<endl;
cout<<"资产的状态为"<<tail->zt<<endl;
cout<<"资产的使用者为"<<tail->use<<endl;
cout<<"资产的备注为"<<tail->bz<<endl;
}
}
//人员信息类及其函数
class people:public Manager
{
public:
int bh;//编号
string zw;//职务
string bz;//备注,存储员工所属资产
void pshow();
void pdisplay();//显示
void pupdate();//修改
void padd();//添加
void pdelete();//删除
void psearch();//查询
} T[N];
void people::pshow()
{
cout<<"----人员信息管理-----"<<endl;
cout<<"1.添加人员信息"<<endl;
cout<<"2.修改人员信息"<<endl;
cout<<"3.查询人员信息"<<endl;
cout<<"4.删除人员信息"<<endl;
cout<<"5.显示已有人员信息"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择"<<endl;
}
void people::padd()//增加人员信息
{
cout<<"编号为"<<ss<<endl;
T[ss].bh=ss;
cout<<"请输入姓名"<<endl;
cin>>T[ss].name;
cout<<"请输入职务"<<endl;
cin>>T[ss].zw;
cout<<"请输入备注(代表人员可以使用的资产)"<<endl;
cin>>T[ss].bz;
ss++;
}
void people::pdelete()//删除人员信息
{
int se;
cout<<"请输入要删除人员的编号(编号从0开始)"<<endl;
cin>>se;
for(int j=se; j<ss-1; j++)
{
T[j]=T[j+1];
}
ss-=1;
}
void people::psearch()//查询人员信息
{
int se;
cout<<"请输入要查询人员的编号(编号从0开始)"<<endl;
cin>>se;
cout<<"姓名为"<<T[se].name<<endl;
cout<<"职务为"<<T[se].zw<<endl;
cout<<"备注为"<<T[se].bz<<endl;
}
void people::pdisplay()//显示人员信息
{
for(int i=0; i<ss; i++)
{
cout<<"编号为"<<T[i].bh<<endl;
cout<<"姓名为"<<T[i].name<<endl;
cout<<"职务为"<<T[i].zw<<endl;
cout<<"备注为"<<T[i].bz<<endl;
}
}
void people::pupdate()//修改人员信息
{
int se;
cout<<"请输入要修改人员的编号"<<endl;
cin>>se;
cout<<"请重新输入姓名"<<endl;
cin>>T[se].name;
cout<<"请重新输入职务"<<endl;
cin>>T[se].zw;
cout<<"请重新输入备注"<<endl;
cin>>T[se].bz;
}
//资产分配类及其函数
class Fmoney//用于资产分配
{
public:
int djbh;//登记表的编号
int bh;//设备编号
string time;//领用时间
string gl;//管理员
string yt;//用途
string bz;//备注
people temp;//类对象,用于登记人员
void Fshow();
void LY();//领用函数
void GH();//归还函数
} Y[N],U[N]; //登记表,归还表
void Fmoney::Fshow()
{
cout<<"----资产分配----"<<endl;
cout<<"1.领用"<<endl;
cout<<"2.归还"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择"<<endl;
}
void Fmoney::LY()//领用函数
{
int se;
bool se1=false;
cout<<"请输入已经登记人员的编号(从0开始)"<<endl;
cin>>se;
if(se>=ss)
{
cout<<"输入人员编号有误"<<endl;
return ;
}
cout<<"登记表的编号为"<<rr<<endl;
Y[rr].djbh=rr;
Y[rr].temp=T[se];
cout<<"请输入设备编号"<<endl;
cin>>Y[rr].bh;
for(class Money *ppp=head1->next; ppp!=NULL; ppp=ppp->next)
{
if(ppp->bh==Y[rr].bh&&ppp->zt=="正常"&&ppp->use=="空")
{
se1=true;
ppp->use="使用中";//改变设备状态
break;
}
}
if(se1==false)
{
cout<<"此资产不能用"<<endl;
return ;
}
cout<<"请输入领用日期"<<endl;
cin>>Y[rr].time;
cout<<"请输入管理员编号"<<endl;
cin>>Y[rr].gl;
cout<<"请输入用途"<<endl;
cin>>Y[rr].yt;
cout<<"请输入备注"<<endl;
cin>>Y[rr++].bz;
}
void Fmoney::GH()//归还函数
{
cout<<"请输入你要归还的资产编号(从0开始)"<<endl;
int se;
cin>>se;
if(se>=rr)
{
cout<<"你输入归还的资产编号错误"<<endl;
return ;
}
for(class Money *ppp=head1->next; ppp!=NULL; ppp=ppp->next)
{
if(ppp->bh==se)
{
ppp->use="空";//改变设备状态
break;
}
}
cout<<"请输入归还日期"<<endl;
cin>>U[r2].time;
cout<<"归还管理员为"<<Y[se].gl<<endl;
U[r2++].gl=Y[se].gl;
for(int j=se; j<rr-1; j++)
{
Y[j]=Y[j+1];
}
rr-=1;
}
//资产处置类及其函数
class Cmoney//用于资产处置
{
public:
void Cshow();
void tiaobo();//调拨
void bianmai();//变卖
void baofei();//报废
};
void Cmoney::Cshow()
{
cout<<"----资产处置-----"<<endl;
cout<<"1.调拨"<<endl;
cout<<"2.变卖"<<endl;
cout<<"3.报废"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择:"<<endl;
}
void Cmoney::tiaobo()//资产的调拨
{
cout<<"--请输入你要调拨的方式--"<<endl;
cout<<"1.通过变更资产使用人"<<endl;
cout<<"2.通过改变存放位置"<<endl;
cout<<"3.通过改变资产状态"<<endl;
cout<<"请输入您的选择: "<<endl;
int sele;
cin>>sele;
if(sele==1)
{
cout<<"请输入您要调拨资产的两个人的编号A与B,将资产A给B"<<endl;
int bh1,bh2;
cin>>bh1>>bh2;
T[bh2].bz=T[bh2].bz+T[bh1].bz;
T[bh1].bz="\0";
}
else if(sele==2)
{
cout<<"请输入您要改变资产存放的位置,如A与B互换"<<endl;
int se1,se2;
cin>>se1>>se2;
for(class Money *ppp=head1->next; ppp!=NULL; ppp=ppp->next)
{
if(ppp->bh==se1||ppp->bh==se2)
{
if(ppp->bh==se1)
{
ppp->bh=se2;
}
if(ppp->bh==se2)
{
ppp->bh=se1;
}
}
}
}
else if(sele==3)
{
cout<<"请输入您要改变资产状态的编号"<<endl;
int se;
string str;
cin>>se;
for(class Money *ppp=head1->next; ppp!=NULL; ppp=ppp->next)
{
if(ppp->bh==se)
{
cout<<"请输入您要改变资产状态的状态"<<endl;
cin>>str;
ppp->zt=str;
break;
}
}
}
}
void Cmoney::bianmai()//变卖函数
{
cout<<"请输入变卖的资产的编号"<<endl;
int se;
cin>>se;
class Money *ppp,*tail;
for(tail=head1,ppp=head1->next; ppp!=NULL; ppp=ppp->next,tail=tail->next)
{
if(ppp->bh==se&&ppp->zt=="空")
{
tail->next=ppp->next;
ppp->next=NULL;
delete ppp;
cout<<"变卖成功"<<endl;
return ;
}
}
cout<<"先归还此资产"<<endl;
for(ppp=head1->next; ppp!=NULL; ppp=ppp->next)
{
if(ppp->bh==se)
{
ppp->use="空";//改变设备状态
break;
}
}
cout<<"请输入归还日期"<<endl;
cin>>U[r2].time;
cout<<"归还管理员为"<<Y[se].gl<<endl;
U[r2++].gl=Y[se].gl;
for(int j=se; j<rr-1; j++)
{
Y[j]=Y[j+1];
}
rr-=1;
cout<<"变卖成功"<<endl;
}
void Cmoney::baofei()
{
cout<<"请输入要报废资产的编号"<<endl;
int se;
cin>>se;
for(class Money *ppp=head1->next; ppp!=NULL; ppp=ppp->next)
{
if(ppp->use=="空")
{
ppp->zt="报废";
cout<<"报废成功"<<endl;
return ;
}
}
cout<<"无法报废"<<endl;
}
//-----------------------------------------------------------------
void Showmain1()
{
cout<<"---------固定资产管理系统----------"<<endl;
cout<<"1.管理员登录"<<endl;
cout<<"2.退出系统"<<endl;
cout<<"请输入您的选择: "<<endl;
}
void enter()
{
cout<<"-----登录页面-----"<<endl;
cout<<"1.直接登录"<<endl;
cout<<"2.注册新用户"<<endl;
cout<<"3.修改密码"<<endl;
cout<<"请输入您的选择: "<<endl;
flag=false;
int se;//选择
Manager TEMP;//暂时借助的对象
cin>>se;
if(se==1)
{
TEMP.denglu();//登录函数
}
else if(se==2)
{
TEMP.zhuce();//注册
}
else if(se==3)
{
TEMP.update();//修改密码
}
else
{
cout<<"输入错误,请重新输入"<<endl;
}
}
void SHOWMAIN()
{
cout<<"--------------固定资产管理系统-------------"<<endl;
cout<<"1.资产信息管理"<<endl;
cout<<"2.人员信息管理"<<endl;
cout<<"3.资产配置"<<endl;
cout<<"4.资产处置"<<endl;
cout<<"5.用户管理"<<endl;
cout<<"0.返回上一级"<<endl;
cout<<"请输入您的选择:"<<endl;
}
void Guding()//固定资产管理系统函数
{
int SE;//选择
int ssee;//选择
int mssee;//选择
SHOWMAIN();//主菜单
while(cin>>SE)
{
if(SE==0)
{
cout<<"回到主菜单"<<endl;
break;
}
else if(SE==1)//资产信息管理
{
Money Tp;//暂时使用对象
Tp.show();
while(cin>>ssee)
{
if(ssee==0)
{
break;//返回上一级
}
else if(ssee==1)//对固定资产类别管理
{
if(SE22)
{
head1->next=NULL;
SE22=false;
}
Tp.show11();
while(cin>>mssee)
{
if(mssee==0)
{
break;//返回上一级
}
else if(mssee==1)//添加固定资产设备
{
Tp.add();
}
else if(mssee==2)//删除固定资产设备
{
Tp.delet();
}
else if(mssee==3)//显示已有小类设备
{
Tp.sdisplay();
}
else if(mssee==4)//显示已有大类设备
{
Tp.bdisplay();
}
Tp.show11();
}
}
else if(ssee==2)
{
Tp.show22();
while(cin>>mssee)
{
if(mssee==0)
{
break;//返回上一级
}
else if(mssee==1)//添加固定资产信息
{
Tp.xadd();
}
else if(mssee==2)//删除固定资产信息
{
Tp.xdelet();
}
else if(mssee==3)//修改固定资产信息
{
Tp.xupdate();
}
else if(mssee==4)//显示固定资产信息
{
Tp.xdisplay();
}
Tp.show22();
}
}
Tp.show();
}
}
else if(SE==2)//人员信息管理
{
people Tp;//暂时使用对象
Tp.pshow();
while(cin>>ssee)
{
if(ssee==0)
{
break;//返回上一级
}
switch(ssee)
{
case 1:
Tp.padd();
break;//增加
case 2:
Tp.pupdate();
break;//修改
case 3:
Tp.psearch();
break;//查询
case 4:
Tp.pdelete();
break;//删除
case 5:
Tp.pdisplay();
break;//显示
default :
cout<<"输入有误"<<endl;
break;
}
Tp.pshow();
}
}
else if(SE==3)//资产配置
{
Fmoney Tp;//暂时使用对象
Tp.Fshow();
while(cin>>ssee)
{
if(ssee==0)
{
break;//返回上一级
}
switch(ssee)
{
case 1:
Tp.LY();
break;//增加
case 2:
Tp.GH();
break;//修改
default :
cout<<"输入有误"<<endl;
break;
}
Tp.Fshow();
}
}
else if(SE==4)//资产处置
{
Cmoney Tp;//暂时使用对象
Tp.Cshow();
while(cin>>ssee)
{
if(ssee==0)
{
break;//返回上一级
}
switch(ssee)
{
case 1:
Tp.tiaobo();
break;//挑拨
case 2:
Tp.bianmai();
break;//变卖
case 3:
Tp.baofei();
break;//报废
default :
cout<<"输入有误"<<endl;
break;
}
Tp.Cshow();
}
}
else if(SE==5)//用户管理
{
Manager Tp;//暂时使用对象
Tp.Mshow();
while(cin>>ssee)
{
if(ssee==0)
{
break;//返回上一级
}
switch(ssee)
{
case 1:
Tp.Madd();
break;//增加
case 2:
Tp.Mupdate();
break;//修改
case 3:
Tp.Msearch();
break;//查询
case 4:
Tp.Mdelete();
break;//删除
case 5:
Tp.Mdisplay();
break;//显示
default :
cout<<"输入有误"<<endl;
break;
}
Tp.Mshow();
}
}
SHOWMAIN();//主菜单
}
}
int main()
{
init();
int choose=0;
Showmain1();
cin>>choose;
while(1)
{
if(choose==1)
{
flag=false;
enter();//登录函数
if(flag)//登陆成功
{
Guding();//进入固定资产管理系统
}
}
else if(choose==2)
{
cout<<"是否退出系统,如果退出请输入数字1"<<endl;
int tempp=0;
cin>>tempp;
if(tempp==1)
{
cout<<"退出系统成功,欢迎再次使用"<<endl;
}
}
else
{
cout<<"输入错误,请重新输入"<<endl;
}
Showmain1();
cin>>choose;
}
return 0;
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
- 152.
- 153.
- 154.
- 155.
- 156.
- 157.
- 158.
- 159.
- 160.
- 161.
- 162.
- 163.
- 164.
- 165.
- 166.
- 167.
- 168.
- 169.
- 170.
- 171.
- 172.
- 173.
- 174.
- 175.
- 176.
- 177.
- 178.
- 179.
- 180.
- 181.
- 182.
- 183.
- 184.
- 185.
- 186.
- 187.
- 188.
- 189.
- 190.
- 191.
- 192.
- 193.
- 194.
- 195.
- 196.
- 197.
- 198.
- 199.
- 200.
- 201.
- 202.
- 203.
- 204.
- 205.
- 206.
- 207.
- 208.
- 209.
- 210.
- 211.
- 212.
- 213.
- 214.
- 215.
- 216.
- 217.
- 218.
- 219.
- 220.
- 221.
- 222.
- 223.
- 224.
- 225.
- 226.
- 227.
- 228.
- 229.
- 230.
- 231.
- 232.
- 233.
- 234.
- 235.
- 236.
- 237.
- 238.
- 239.
- 240.
- 241.
- 242.
- 243.
- 244.
- 245.
- 246.
- 247.
- 248.
- 249.
- 250.
- 251.
- 252.
- 253.
- 254.
- 255.
- 256.
- 257.
- 258.
- 259.
- 260.
- 261.
- 262.
- 263.
- 264.
- 265.
- 266.
- 267.
- 268.
- 269.
- 270.
- 271.
- 272.
- 273.
- 274.
- 275.
- 276.
- 277.
- 278.
- 279.
- 280.
- 281.
- 282.
- 283.
- 284.
- 285.
- 286.
- 287.
- 288.
- 289.
- 290.
- 291.
- 292.
- 293.
- 294.
- 295.
- 296.
- 297.
- 298.
- 299.
- 300.
- 301.
- 302.
- 303.
- 304.
- 305.
- 306.
- 307.
- 308.
- 309.
- 310.
- 311.
- 312.
- 313.
- 314.
- 315.
- 316.
- 317.
- 318.
- 319.
- 320.
- 321.
- 322.
- 323.
- 324.
- 325.
- 326.
- 327.
- 328.
- 329.
- 330.
- 331.
- 332.
- 333.
- 334.
- 335.
- 336.
- 337.
- 338.
- 339.
- 340.
- 341.
- 342.
- 343.
- 344.
- 345.
- 346.
- 347.
- 348.
- 349.
- 350.
- 351.
- 352.
- 353.
- 354.
- 355.
- 356.
- 357.
- 358.
- 359.
- 360.
- 361.
- 362.
- 363.
- 364.
- 365.
- 366.
- 367.
- 368.
- 369.
- 370.
- 371.
- 372.
- 373.
- 374.
- 375.
- 376.
- 377.
- 378.
- 379.
- 380.
- 381.
- 382.
- 383.
- 384.
- 385.
- 386.
- 387.
- 388.
- 389.
- 390.
- 391.
- 392.
- 393.
- 394.
- 395.
- 396.
- 397.
- 398.
- 399.
- 400.
- 401.
- 402.
- 403.
- 404.
- 405.
- 406.
- 407.
- 408.
- 409.
- 410.
- 411.
- 412.
- 413.
- 414.
- 415.
- 416.
- 417.
- 418.
- 419.
- 420.
- 421.
- 422.
- 423.
- 424.
- 425.
- 426.
- 427.
- 428.
- 429.
- 430.
- 431.
- 432.
- 433.
- 434.
- 435.
- 436.
- 437.
- 438.
- 439.
- 440.
- 441.
- 442.
- 443.
- 444.
- 445.
- 446.
- 447.
- 448.
- 449.
- 450.
- 451.
- 452.
- 453.
- 454.
- 455.
- 456.
- 457.
- 458.
- 459.
- 460.
- 461.
- 462.
- 463.
- 464.
- 465.
- 466.
- 467.
- 468.
- 469.
- 470.
- 471.
- 472.
- 473.
- 474.
- 475.
- 476.
- 477.
- 478.
- 479.
- 480.
- 481.
- 482.
- 483.
- 484.
- 485.
- 486.
- 487.
- 488.
- 489.
- 490.
- 491.
- 492.
- 493.
- 494.
- 495.
- 496.
- 497.
- 498.
- 499.
- 500.
- 501.
- 502.
- 503.
- 504.
- 505.
- 506.
- 507.
- 508.
- 509.
- 510.
- 511.
- 512.
- 513.
- 514.
- 515.
- 516.
- 517.
- 518.
- 519.
- 520.
- 521.
- 522.
- 523.
- 524.
- 525.
- 526.
- 527.
- 528.
- 529.
- 530.
- 531.
- 532.
- 533.
- 534.
- 535.
- 536.
- 537.
- 538.
- 539.
- 540.
- 541.
- 542.
- 543.
- 544.
- 545.
- 546.
- 547.
- 548.
- 549.
- 550.
- 551.
- 552.
- 553.
- 554.
- 555.
- 556.
- 557.
- 558.
- 559.
- 560.
- 561.
- 562.
- 563.
- 564.
- 565.
- 566.
- 567.
- 568.
- 569.
- 570.
- 571.
- 572.
- 573.
- 574.
- 575.
- 576.
- 577.
- 578.
- 579.
- 580.
- 581.
- 582.
- 583.
- 584.
- 585.
- 586.
- 587.
- 588.
- 589.
- 590.
- 591.
- 592.
- 593.
- 594.
- 595.
- 596.
- 597.
- 598.
- 599.
- 600.
- 601.
- 602.
- 603.
- 604.
- 605.
- 606.
- 607.
- 608.
- 609.
- 610.
- 611.
- 612.
- 613.
- 614.
- 615.
- 616.
- 617.
- 618.
- 619.
- 620.
- 621.
- 622.
- 623.
- 624.
- 625.
- 626.
- 627.
- 628.
- 629.
- 630.
- 631.
- 632.
- 633.
- 634.
- 635.
- 636.
- 637.
- 638.
- 639.
- 640.
- 641.
- 642.
- 643.
- 644.
- 645.
- 646.
- 647.
- 648.
- 649.
- 650.
- 651.
- 652.
- 653.
- 654.
- 655.
- 656.
- 657.
- 658.
- 659.
- 660.
- 661.
- 662.
- 663.
- 664.
- 665.
- 666.
- 667.
- 668.
- 669.
- 670.
- 671.
- 672.
- 673.
- 674.
- 675.
- 676.
- 677.
- 678.
- 679.
- 680.
- 681.
- 682.
- 683.
- 684.
- 685.
- 686.
- 687.
- 688.
- 689.
- 690.
- 691.
- 692.
- 693.
- 694.
- 695.
- 696.
- 697.
- 698.
- 699.
- 700.
- 701.
- 702.
- 703.
- 704.
- 705.
- 706.
- 707.
- 708.
- 709.
- 710.
- 711.
- 712.
- 713.
- 714.
- 715.
- 716.
- 717.
- 718.
- 719.
- 720.
- 721.
- 722.
- 723.
- 724.
- 725.
- 726.
- 727.
- 728.
- 729.
- 730.
- 731.
- 732.
- 733.
- 734.
- 735.
- 736.
- 737.
- 738.
- 739.
- 740.
- 741.
- 742.
- 743.
- 744.
- 745.
- 746.
- 747.
- 748.
- 749.
- 750.
- 751.
- 752.
- 753.
- 754.
- 755.
- 756.
- 757.
- 758.
- 759.
- 760.
- 761.
- 762.
- 763.
- 764.
- 765.
- 766.
- 767.
- 768.
- 769.
- 770.
- 771.
- 772.
- 773.
- 774.
- 775.
- 776.
- 777.
- 778.
- 779.
- 780.
- 781.
- 782.
- 783.
- 784.
- 785.
- 786.
- 787.
- 788.
- 789.
- 790.
- 791.
- 792.
- 793.
- 794.
- 795.
- 796.
- 797.
- 798.
- 799.
- 800.
- 801.
- 802.
- 803.
- 804.
- 805.
- 806.
- 807.
- 808.
- 809.
- 810.
- 811.
- 812.
- 813.
- 814.
- 815.
- 816.
- 817.
- 818.
- 819.
- 820.
- 821.
- 822.
- 823.
- 824.
- 825.
- 826.
- 827.
- 828.
- 829.
- 830.
- 831.
- 832.
- 833.
- 834.
- 835.
- 836.
- 837.
- 838.
- 839.
- 840.
- 841.
- 842.
- 843.
- 844.
- 845.
- 846.
- 847.
- 848.
- 849.
- 850.
- 851.
- 852.
- 853.
- 854.
- 855.
- 856.
- 857.
- 858.
- 859.
- 860.
- 861.
- 862.
- 863.
- 864.
- 865.
- 866.
- 867.
- 868.
- 869.
- 870.
- 871.
- 872.
- 873.
- 874.
- 875.
- 876.
- 877.
- 878.
- 879.
- 880.
- 881.
- 882.
- 883.
- 884.
- 885.
- 886.
- 887.
- 888.
- 889.
- 890.
- 891.
- 892.
- 893.
- 894.
- 895.
- 896.
- 897.
- 898.
- 899.
- 900.
- 901.
- 902.
- 903.
- 904.
- 905.
- 906.
- 907.
- 908.
- 909.
- 910.
- 911.
- 912.
- 913.
- 914.
- 915.
- 916.
- 917.
- 918.
- 919.
- 920.
- 921.
- 922.
- 923.
- 924.
- 925.
- 926.
- 927.
- 928.
- 929.
- 930.
- 931.
- 932.
- 933.
- 934.
- 935.
- 936.
- 937.
- 938.
- 939.
- 940.
- 941.
- 942.
- 943.
- 944.
- 945.
- 946.
- 947.
- 948.
- 949.
- 950.
- 951.
- 952.
- 953.
- 954.
- 955.
- 956.
- 957.
- 958.
- 959.
- 960.
- 961.
- 962.
- 963.
- 964.
- 965.
- 966.
- 967.
- 968.
- 969.
- 970.
- 971.
- 972.
- 973.
- 974.
- 975.
- 976.
- 977.
- 978.
- 979.
- 980.
- 981.
- 982.
- 983.
- 984.
- 985.
- 986.
- 987.
- 988.
- 989.
- 990.
- 991.
- 992.
- 993.
- 994.
- 995.
- 996.
- 997.
- 998.
- 999.
- 1000.
- 1001.
- 1002.
- 1003.
- 1004.
- 1005.
- 1006.
- 1007.
- 1008.
- 1009.
- 1010.
- 1011.
- 1012.
- 1013.
- 1014.
- 1015.
- 1016.
- 1017.
- 1018.
- 1019.
- 1020.
- 1021.
- 1022.
- 1023.
- 1024.
- 1025.
- 1026.
- 1027.
- 1028.
- 1029.
- 1030.
- 1031.
- 1032.
View Code