#include "EmployManagement.h"
#include "Employ.h"
#include <vector>
#include <iostream>
#include <string>
#include <fstream>
#include <algorithm>
using namespace std;
EmployManagement::EmployManagement()
{
}
EmployManagement::~EmployManagement()
{
}
void EmployManagement::registEmploy()
{
while (true)
{
Employ employ;
string id, name, gender, department;
int age;
double salary;
char ch;
cout << "please input employ's info:" << endl;
cout << "id:" << endl;
cin >> id;
cout << "name:" << endl;
cin >> name;
cout << "gender:" << endl;
cin >> gender;
cout << "age" << endl;
cin >> age;
cout << "department" << endl;
cin >> department;
cout << "salary" << endl;
cin >> salary;
employ.init(id, name, age, gender, department, salary);
employVector.push_back(employ);
cout << "continue to regist? y/n" << endl;
cin >> ch;
if (ch == 'n')
break;
}
}
void EmployManagement::findEmploy()
{
string id, name;
//vector<Employ>::iterator EmployIter;
//EmployIter = employVector.begin();
int i = 0;
while (true)
{
char ch;
int flag;
cout << "depend on id or name :1,2" << endl;
cin >> flag;
if (flag == 1)
{
string id;
cout << "input id:" << endl;
cin >> id;
for (i = 0; i < employVector.size();i++)
{
if (id == employVector[i].getId())
{
employVector[i].showInfo();
break;
}
}
}
else if (flag == 2)
{
string name;
cout << "input name:" << endl;
cin >> name;
for (i = 0; i < employVector.size(); i++)
{
if (name == employVector[i].getName())
{
employVector[i].showInfo();
break;
}
}
}
else{
cout << "error!" << endl;
}
cout << "continue to find? y/n" << endl;
cin >> ch;
if (ch == 'n')
break;
}
}
void EmployManagement::updateEmploy()
{
string id;
vector<Employ>::iterator EmployIter;
string newId,newName,newGender,newDepartment;
int newAge;
double newSalary;
char ch;
while (true)
{
cout << "input id:" << endl;
cin >> id;
for (EmployIter = employVector.begin(); EmployIter != employVector.end(); EmployIter++)
{
if (id == EmployIter->getId())
{
EmployIter->showInfo();
cout << "update: 1:id, 2:name,3:age, 4:gender, 5:department, 6:salary" << endl;
int flag;
cin >> flag;
switch (flag)
{
case 1: cin >> newId; EmployIter->setId(newId); break;
case 2:cin >> newName; EmployIter->setName(newName); break;
case 3:cin >> newAge; EmployIter->setAge(newAge); break;
case 4:cin >> newGender; EmployIter->setGender(newGender); break;
case 5:cin >> newDepartment; EmployIter->setDepartment(newDepartment); break;
case 6:cin >> newSalary; EmployIter->setSalary(newSalary); break;
default:
break;
}
break;
}
}
cout << "continue to update? y/n" << endl;
cin >> ch;
if (ch == 'n')
break;
}
}
void EmployManagement::deleteEmploy()
{
string id;
vector<Employ>::iterator EmployIter;
while (true)
{
cout << "input id:" << endl;
cin >> id;
char ch,flag;
for (EmployIter = employVector.begin(); EmployIter != employVector.end(); EmployIter++)
{
if (id == EmployIter->getId())
{
EmployIter->showInfo();
cout << "really want to delete? y/n" << endl;
cin >> flag;
break;
}
}
if (flag == 'y')
EmployIter=employVector.erase(EmployIter);
cout << "continue to delete? y/n" << endl;
cin >> ch;
if (ch == 'n')
break;
}
}
void EmployManagement::sortEmploy()
{
vector<Employ> newVector;
int i = 0,j=0;
for (i = 0; i < employVector.size();i++)
{
for (j = i+1; j < employVector.size(); j++)
{
if (employVector[i].getSalary() < employVector[j].getSalary())
swap(employVector[i], employVector[j]);
}
}
cout << "sort out" << endl;
}
void EmployManagement::saveInfo(ofstream &outFile)
{
vector<Employ>::iterator EmployIter;
cout << "show and save:" << endl;
for (EmployIter = employVector.begin(); EmployIter != employVector.end(); EmployIter++)
{
EmployIter->showInfo();
outFile << "id:" << EmployIter->getId() << ",name:" << EmployIter->getName() << ",age:" << EmployIter->getAge() << ",gender:" << EmployIter->getGender() << ",department:" << EmployIter->getDepartment() << ",salary:" << EmployIter->getSalary() << endl;
}
outFile.close();
}
没有合适的资源?快使用搜索试试~ 我知道了~
C++编写的ERP管理系统
共26个文件
tlog:6个
cpp:3个
obj:3个
1星 需积分: 1 96 下载量 43 浏览量
2015-02-15
16:28:58
上传
评论 5
收藏 2.15MB RAR 举报
温馨提示
用C++编写的ERP管理系统,实现了基本的功能,没有界面,简单的后端demo,用于学习C++程序设计,可以运行。
资源推荐
资源详情
资源评论
收起资源包目录
ERP.rar (26个子文件)
ERP
ERP.sdf 8.38MB
ERP.v12.suo 26KB
ERP.sln 955B
Debug
ERP.pdb 1.17MB
ERP.exe 138KB
ERP.ilk 758KB
ERP
test.cpp 852B
Employ.cpp 1KB
Employ.h 653B
EmployManagement.h 360B
ERP.vcxproj 3KB
EmployManagement.cpp 4KB
ERP.vcxproj.filters 1KB
Debug
test.obj 260KB
vc120.pdb 396KB
EmployManagement.obj 383KB
ERP.log 2KB
Employ.obj 189KB
vc120.idb 371KB
ERP.tlog
CL.write.1.tlog 2KB
CL.read.1.tlog 37KB
cl.command.1.tlog 1KB
ERP.lastbuildstate 162B
link.write.1.tlog 490B
link.command.1.tlog 1KB
link.read.1.tlog 3KB
共 26 条
- 1
资源评论
- wangxb25552016-12-30这是叫啥ERP
Emmitte
- 粉丝: 121
- 资源: 70
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功