C++课程设计 教职工信息管理系统源代码

时间:2019-05-14 03:48:47下载本文作者:会员上传
简介:写写帮文库小编为你整理了多篇相关的《C++课程设计 教职工信息管理系统源代码》,但愿对你工作学习有帮助,当然你在写写帮文库还可以找到更多《C++课程设计 教职工信息管理系统源代码》。

第一篇:C++课程设计 教职工信息管理系统源代码

教职工信息管理系统源码

#include #include #include #include

#define maxsize 100 fstream iofile;//文件指针

class Time //时间类 {

public:

int year;

int month;

int day;};

class Telem //个人信息 {

public:

char name[20];

char sex[10];

Time birthtime;//组合Time类

char num[20];

char wage[20];

Time worktime;

int year;

char department[20];

friend istream& operator>>(istream& input,Telem& T);

friend ostream& operator<<(ostream& output,Telem& T);

friend int operator-(Time & t1,Time & t2);};

class People:virtual public Telem //雇员类 {

public:

People();

virtual void AddF()=0;//添加

virtual void Addall()=0;

virtual void Add()=0;

virtual void Display();//输出数组的内容

virtual void Displaypart(char p[]);

virtual void Findname(char n[]);

virtual void Findyear(int);

virtual void Del(char n[])=0;

virtual void Del(int);protected:

Telem data[maxsize];

Time now;

int length;};

class Teacher:virtual public People //派生虚基类 {

public:

virtual void AddF();

virtual void Addall();

virtual void Add();

virtual void Display();

virtual void Del(int i);

virtual void Del(char n[]);};

class worker:virtual public People //派生虚基类 {

public:

virtual void AddF();

virtual void Addall();

virtual void Add();

virtual void Display();

virtual void Del(int i);

virtual void Del(char n[]);};

People::People()//系统自动生成的构造函数 {

length=0;

now.year=2010;

now.month=7;

now.day=6;}

void People::Display()//引用 {

int i;

for(i=0;i

cout<

void People::Displaypart(char p[])//引用数组

{

int i,c;

for(i=0;i

if(strcmp(data[i].wage,p)==0)

{

cout<<“输出选择姓名1 性别2 编号3 工资4 出生日期5 工作时间6 年龄7 系别8 退出选择9”<

while(cin>>c)

{

switch(c)

{

case 1: cout<<“姓名:”<

case 2: cout<<“性别:”<

case 3: cout<<“编号:”<

case 4: cout<<“工资:”<

case 5: cout<<“出生日期:”<

case 6: cout<<“工作时间:”<

case 7: cout<<“年龄:”<

case 8: cout<<“系别:”<

case 9: goto loop;

default:cout<<“操作错误......”<

}

}

loop:;

} }

void People::Findname(char n[])//引用 {

int i;

for(i=0;i

if(strcmp(data[i].name,n)==0)//对象引用

cout<

void People::Findyear(int y){

int i;

for(i=0;i

if(data[i].year==y)

cout<

void People::Del(int i){

int j;

if(i<1||i>length)

cout<<“不存在第”<

for(j=i;j

data[j-1]=data[j];

length--;}

void worker::AddF(){

int flag=0;

iofile.open(“worker_information.txt”,ios::in|ios::binary);//文件的打开与关闭

while(iofile.seekg(ios::cur))

{

iofile.seekg(length*sizeof(data[length]),ios::beg);

iofile.read((char*)&data[length],sizeof(data[length]));//文件的随机访问

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

}

People::Del(length);

cout<<“添加人员信息成功......”<

loop:

if(1==flag)

cout<<“人员信息储存空间已满......”<

iofile.close();}

void worker::Addall(){

char ans;

int flag=0;

iofile.open(“worker_information.txt”,ios::out|ios::binary);

do

{

cin>>data[length];

data[length].year=now-data[length].birthtime;

iofile.write((char*)&data[length],sizeof(data[length]));

cout<<“添加人员信息成功......”<

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

cout<<“contine(Y|N)?”;

cin>>ans;

}while('y'==ans||'Y'==ans);loop:

if(1==flag)

cout<<“人员信息储存空间已满......”<

iofile.close();}

void worker::Add(){

int flag=0;

iofile.open(“worker_information.txt”,ios::app|ios::out|ios::binary);

if(length==maxsize)

{

flag=1;

goto loop;

}

cin>>data[length];

data[length].year=now-data[length].birthtime;

iofile.write((char*)&data[length],sizeof(data[length]));

cout<<“添加人员信息成功......”<

length++;

loop:

if(1==flag)

cout<<“人员信息储存空间已满......”<

iofile.close();}

void worker::Display(){

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆工人信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

if(0==length)

cout<<“无......”<

int i;

for(i=0;i

cout<

int i,j,k;

for(i=0;i

if(strcmp(data[i].name,n)==0){

k=i+1;break;}

if(k<1)

cout<<“不存在姓名”<

for(j=k;j

data[j-1]=data[j];

length--;

cout<<“删除人员信息成功......”<

void worker::Del(int i){

int j;

if(i<1||i>length)

cout<<“不存在第”<

for(j=i;j

data[j-1]=data[j];

length--;

cout<<“删除成功......”<

}

void Teacher::AddF(){

int flag=0;

iofile.open(“Teacher_information.txt”,ios::in|ios::binary);

while(iofile.seekg(sizeof(data[length]),ios::cur))

{

if(iofile.seekg(length*sizeof(data[length]),ios::beg))

iofile.read((char*)&data[length],sizeof(data[length]));

else

break;

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

}

People::Del(length);

cout<<“添加人员信息成功......”<

if(1==flag)

cout<<“人员信息储存空间已满......”<

iofile.close();}

void Teacher::Addall(){

char ans;

int flag=0;

iofile.open(“Teacher_information.txt”,ios::in|ios::out|ios::binary);

do

{

cin>>data[length];

data[length].year=now-data[length].birthtime;

iofile.write((char*)&data[length],sizeof(data[length]));

cout<<“添加人员信息成功......”<

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

cout<<“contine(Y|N)?”;

cin>>ans;

}while('y'==ans||'Y'==ans);loop:

if(1==flag)

cout<<“人员信息储存空间已满......”<

iofile.close();}

void Teacher::Add(){

int flag=0;

iofile.open(“Teacher_information.txt”,ios::app|ios::out|ios::binary);

if(length==maxsize)

{

flag=1;

goto loop;

}

cin>>data[length];

data[length].year=now-data[length].birthtime;

iofile.write((char*)&data[length],sizeof(data[length]));

cout<<“添加人员信息成功......”<

length++;loop:

if(1==flag)

cout<<“人员信息储存空间已满......”<

iofile.close();}

void Teacher::Display(){

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆教师信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

if(0==length)

cout<<“无......”<

int i;

for(i=0;i

cout<

void Teacher::Del(char n[]){

int i,j,k;

for(i=0;i

if(strcmp(data[i].name,n)==0)

{

k=i+1;break;

}

if(k<1)cout<<“不存在姓名”<

for(j=k;j

data[j-1]=data[j];

length--;

cout<<“删除人员信息成功......”<

void Teacher::Del(int i){

int j;

if(i<1||i>length)

cout<<“不存在第”<

for(j=i;j

data[j-1]=data[j];

length--;

cout<<“删除成功......”<

istream& operator>>(istream& input,Telem& T){

int y,m,d;

cout<<“请输入姓名(以*结尾):”<

input.getline(T.name,20,'*');

cout<<“请输入性别(以*结尾 男或女):”<

input.getline(T.sex,10,'*');

cout<<“编号(以*结尾):”<

input.getline(T.num,20,'*');

cout<<“工资(以*结尾):”<

input.getline(T.wage,20,'*');

cout<<“请输入出生日期:”<

input>>y>>m>>d;

T.birthtime.year=(y>=1900&&y<=2100)?y:1900;

T.birthtime.month=(m>=1&&m<=12)?m:1;

T.birthtime.day=(d>=1&&d<=31)?d:1;

cout<<“请输入系别(以*结尾):”<

input.getline(T.department,20,'*');

cout<<“参加工作时间:”<

input>>y>>m>>d;

T.worktime.year=(y>=1900&&y<=2100)?y:1900;

T.worktime.month=(m>=1&&m<=12)?m:1;

T.worktime.day=(d>=1&&d<=31)?d:1;

return input;}

ostream& operator<<(ostream& output,Telem& T){

cout<<“姓名:”;

output<

cout<<“性别:”;

output<

cout<<“编号:”;

output<

cout<<“工资:”;

output<

cout<<“出生日期:”;

output<

cout<<“系别:”;

output<

cout<<“参加工作时间:”;

output<

cout<<“年龄:”;

output<

return output;}

int operator-(Time & t1,Time & t2){

return t1.year-t2.year;}

void Showmenu(){

cout<

cout<<“

欢 迎 进 入 教 职 工 信 息 管 理 系 统”<

cout<<“

2010 年7月7日发布”<<“

版权所有: swa”<

cout<<“

★ ☆ ★ ☆ ★ ☆ ★ ☆ ★人员信息管理系统★ ☆ ★ ☆ ★ ☆ ★ ☆ ★”<

cout<<“

1-从键盘录入全部人员记录

☆ ”<

cout<<“

☆ 2-增加一位人员记录

★”<

cout<<“

3-显示全部人员记录

☆”<

cout<<“

☆ 4-按系别输出人员信息(可选)★ ”<

cout<<“

5-按姓名或年龄检索所有信息☆ ”<

cout<<“

☆ 6-显示菜单目录

★ ”<

cout<<“

7-结束程序运行

☆ ”<

cout<<“

★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

int main(){

Teacher tea;

worker stu;

People *pt=&tea;

People *ps=&stu;

int c=0,k=0,l=0,i=0;

char nam[20],part[20];Showmenu();

for(;;)

{

cout<<“请根据菜单执行相应操作: ”;

cin>>c;

switch(c)

{

case 1:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★录入全部人员记录 ★ ☆ ★ ☆ ★ ☆ ★”<

cout<<“ ★ ☆ ★ ☆ ★从键盘输入教师信息 ☆ ★ ☆ ★ ☆”<

pt->Addall();

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆从键盘输入工人信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

ps->Addall();

break;

}

case 2:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆从键盘增加一位人员记录 ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆教师操作请按1 工人操作请按2 ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

cin>>k;

if(1==k)

pt->Add();

else if(2==k)

ps->Add();

else

cout<<“操作错误...”<

break;

}

case 3:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆显示全部人员记录 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

pt->Display();

ps->Display();

break;

}

case 4:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆按部门输出人员信息(可选)★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

cout<<“ ★ ☆ ★ ☆ ★ ☆教师操作请按1 工人操作请按2 ★ ☆ ★ ☆ ★ ☆”<

cin>>k;

if(1==k)

{

cout<<“请输入要输出人员的系别(以*结尾):”<

pt->Displaypart(part);

}

else if(2==k)

{

cout<<“请输入要输出人员的系别(以*结尾):”<

ps->Displaypart(part);

}

else

cout<<“操作错误......”<

break;

}

case 5:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★按姓名或年龄检索所有信息 ★ ☆ ★ ☆ ★ ☆ ★”<

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★按姓名查找1 按年龄查找2 ★ ☆ ★ ☆ ★ ☆ ★”<

cin>>k;

if(1==k)

{

cout<<“按姓名查找1 按年龄查找2”<>l;

if(1==l)

{

cout<<“请输入要查找人员的姓名(以*结尾):”<

pt->Findname(nam);

}

else if(2==l)

{

cout<<“请输入要查找人的年龄:”<>i;

pt->Findyear(i);

}

else

cout<<“操作错误......”<

}

else if(2==k)

{

cout<<“按姓名查找1 按年龄查找2”<>l;

if(1==l)

{

cout<<“请输入要查找人员的姓名(以*结尾):”<

ps->Findname(nam);

}

else if(2==l)

{

cout<<“请输入要查找人的年龄:”<>i;

ps->Findyear(i);

}

else

cout<<“操作错误......”<

}

else

cout<<“操作错误......”<

break;

}

case 6:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆显示菜单目录 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

Showmenu();

break;

}

case 7:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆结束程序运行 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

exit(0);

}

default:cout<<“操作错误......”<

}

}

return 0;}

第二篇:C++大作业_职工信息管理系统源代码

#include #include #include using namespace std;

const N=5000;// 定义系统可录入的职工最大数值

string Ename[N];long Enum[N];char Esex[N];int Eage[N];

char Emarriage[N];int Edepart[N];int Eposition[N];int Edegree[N];int Eworktime[N];float Epay[N];

class Employee {

public:

string Employeename;

long Employeenum;

char Employeesex;

int Employeeage;

char Employeemarriage;

int Employeedepart;

int Employeeposition;

int Employeedegree;

int Employeeworktime;

float Employeepay;

static long EmployeeMaxNum;

static float EmployeeBasePay;

void NewInfo();

void ShowInfo();

void showall();

void showdepart(int depart);

void showdegree(int degree);

void showage(int min,int max);

void shownum(long number);

void RefreshInfo();

void DeleteInfo();

float Pay(int Employeegrade);

static int MaxNum();};

class DBOperate {

public:

string Employeename;

long Employeenum;

char Employeesex;

int Employeeage;

char Employeemarriage;

int Employeedepart;

int Employeeposition;

int Employeedegree;

int Employeeworktime;

float Employeepay;

static long EmployeeMaxNum;

static float EmployeeBasePay;

void WriteIn(int iflag);

void ReadOut();

void RefreshMaxNum(int iflag);//iflg=1 or-1 or 0 };

long Employee::EmployeeMaxNum = 1000;float Employee::EmployeeBasePay = 1500;

int Employee::MaxNum()//返回系统已经存储的人数

{

int MN = 0;

ifstream myf;

myf.open(“EmployeeMaxNum.txt”);

myf>>MN;

cout<

myf.close();

return MN;}

void Employee::NewInfo()//添加新职工函数

{

cout<<“新职工姓名: ”;

cin>>Employee::Employeename;

Employee::Employeenum = EmployeeMaxNum + Employee::MaxNum()+1;

cout<<“新职工性别(F为女性,M为男性): ”;

cin>>Employee::Employeesex;

cout<<“新职工年龄: ”;

cin>>Employee::Employeeage;

cout<<“新职工婚姻状况(Y为已婚,N为未婚): ”;

cin>>Employee::Employeemarriage;

cout<<“新职工学历,请输入相应学历的序号: ”<

cout<<“ [1:小学 2:初中 3:高中 4:本科 5:硕士 6:博士] ”;

cin>>Employee::Employeedegree;

while(Employee::Employeedegree!=1&&Employee::Employeedegree!=2&&Employee::Employeedegree!=3&&Employee::Employeedegree!=4&&Employee::Employeedegree!=5&&Employee::Employeedegree!=6)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:小学 2:初中 3:高中 4:本科 5:硕士 6:博士] ”;

cin>>Employee::Employeedegree;

}

cout<<“新职工所在部门,请输入相应部门的序号:”<

cout<<“ [1:董事会 2:销售部 3:人事部 4:客服中心 5:财务部 6:技术研发部 7:安全监察部] ”;

cin>>Employee::Employeedepart;

while(Employee::Employeedepart!=1&&Employee::Employeedepart!=2&&Employee::Employeedepart!=3&&Employee::Employeedepart!=4&&Employee::Employeedepart!=5&&Employee::Employeedepart!=6&&Employee::Employeedepart!=7)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:董事会 2:销售部 3:人事部 4:客服中心 5:财务部 6:技术研发部 7:安全监察部] ”;

cin>>Employee::Employeedepart;

}

cout<<“新职工职位, 请输入相应职位的序号: ”<

cout<<“ [1:临时职工 2: 正式职工 3:部门经理 4:主任 5:董事长] ”;

cin>>Employee::Employeeposition;

while(Employee::Employeeposition!=1&&Employee::Employeeposition!=2&&Employee::Employeeposition!=3&&Employee::Employeeposition!=4&&Employee::Employeeposition!=5)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:临时职员 2: 正式职员 3:部门经理 4:主任 5:董事长] ”;

cin>>Employee::Employeeposition;

}

cout<<“新职工的工作时长(不需要输入单位): ”;

cin>>Employee::Employeeworktime;

Employee::Employeepay = Employee::Pay(Employee::Employeeposition);

DBOperate dbo;

dbo.ReadOut();

int MaxNum = Employee::MaxNum();

Enum[MaxNum] = Employee::Employeenum;

Ename[MaxNum] = Employee::Employeename;

Esex[MaxNum] = Employee::Employeesex;

Eage[MaxNum] = Employee::Employeeage;

Emarriage[MaxNum] = Employee::Employeemarriage;

Edegree[MaxNum] = Employee::Employeedegree;

Edepart[MaxNum] = Employee::Employeedepart;

Eposition[MaxNum] = Employee::Employeeposition;

Eworktime[MaxNum] = Employee::Employeeworktime;

Epay[MaxNum] = Employee::Employeepay;

dbo.WriteIn(1);

cout<<“ 添加新成员成功!”<

void Employee::ShowInfo()//程序主体 数据输出函数

{

int choice1,choice2,min,max;

long searchnum;

Employee e;

cout<<“*******************************************”<

cout<<“-----------1.输出全体职工信息--------------”<

cout<<“-----------2.按职工部门输出----------------”<

cout<<“-----------3.按职工学历输出----------------”<

cout<<“-----------4.按职工年龄输出----------------”<

cout<<“-----------5.按职工编号输出----------------”<

cout<<“*******************************************”<

cout<<“ 请选择查询方式:”;

cin>>choice1;

switch(choice1)

{

case 1: showall();break;

case 2: cout<<“请输入要查询职工的部门编号[1:董事会 2:销售部 3:人事部 4:客服中心 5:财务部 6:技术研发部 7:安全监察部] ”;

cin>>choice2;

e.showdepart(choice2);break;

case 3: cout<<“请输入要查询职工的学历编号: [1:小学 2:初中 3:高中 4:本科 5:硕士 6:博士] ”;

cin>>choice2;

e.showdegree(choice2);break;

case 4: cout<<“请输入要查询的年龄范围: ”;

cout<<“最小值: ”;

cin>>min;

cout<<“最大值: ”;

cin>>max;

e.showage(min,max);break;

case 5: cout<<“请输入要查询的职工编号: ”;

cin>>searchnum;

e.shownum(searchnum);break;

default: cout<<“出错啦!”<

} }

void Employee::showall()//全体职工输出函数

{ int i;

long number;

for(i=0;i

{

number = Enum[i];

shownum(number);

} }

void Employee::showdepart(int depart)//按职工所在部门输出函数

{

int i;

switch(depart)

{

case 1: cout<<“董事会的成员有: ”<

case 2: cout<<“销售部的成员有: ”<

case 3: cout<<“人事部的成员有: ”<

case 4: cout<<“客服中心的成员有: ”<

case 5: cout<<“财务部的成员有: ”<

case 6: cout<<“技术研发部的成员有: ”<

case 7: cout<<“安全监察部的成员有: ”<

default: cout<<“输入错误!>”<

}

for(i=0;i

{

if(Edepart[i] == depart)

{

long number = Enum[i];

shownum(number);

}

else continue;

} }

void Employee::showdegree(int degree)//按职工学历输出函数

{

int i;

switch(degree)

{

case 1:cout<<“初中学历的员工有:”<

case 2:cout<<“初中学历的员工有:”<

case 3:cout<<“高中学历的员工有:”<

case 4:cout<<“本科学历的员工有:”<

case 5:cout<<“硕士学位的员工有:”<

case 6:cout<<“博士学位的员工有:”<

}

for(i=0;i

{

if(Edegree[i] == degree)

{

long number = Enum[i];

shownum(number);

} else continue;

} }

void Employee::showage(int min,int max)//按职工年龄段输出函数

{

int i;

for(i=0;i

{

if(Eage[i]>=min&&Eage[i]<=max)

{

long number = Enum[i];

shownum(number);

}

else continue;

} }

void Employee::shownum(long number)//按职工编号输出函数

{

int i;

for(i=0;i

{

if(Enum[i] == number)

{

cout<<“**********************************”<

cout<<“职工编号:”<

cout<<“姓 名:”<

cout<<“性 别:”;

if(Esex[i]=='F')cout<<“女 ”<

else if(Esex[i]=='M')cout<<“男 ”<

cout<<“年 龄:”<

cout<<“婚姻情况:”;

if(Emarriage[i]=='Y')cout<<“已婚 ”<

else if(Emarriage[i]=='N')cout<<“未婚 ”<

cout<<“学 历:”;

switch(Edegree[i])

{

case 1:cout<<“小 学 ”<

case 2:cout<<“初 中 ”<

case 3:cout<<“高 中 ”<

case 4:cout<<“本 科 ”<

case 5:cout<<“硕 士 ”<

case 6:cout<<“博 士 ”<

}

cout<<“所在部门:”;

switch(Edepart[i])

{

case 1:cout<<“董事会 ”<

case 2:cout<<“销售部 ”<

case 3:cout<<“人事部 ”<

case 4:cout<<“客服中心 ”<

case 5:cout<<“财务部 ”<

case 6:cout<<“技术研发部 ”<

case 7:cout<<“安全监察部 ”<

}

cout<<“所任职务:”;

switch(Eposition[i])

{

case 1:cout<<“临时成员 ”<

case 2:cout<<“正式员工 ”<

case 3:cout<<“部门经理 ”<

case 4:cout<<“主任 ”<

case 5:cout<<“董事长 ”<

}

cout<<“工作时长:”<

cout<<“工资:”<

cout<<“**********************************”<

}

else continue;

} }

void Employee::RefreshInfo()//修改职工信息的函数 {

int cNum = 1000;

DBOperate dbo;

dbo.ReadOut();

void Employee::shownum(long number);

cout<<“请输入您要修改的职工编号:”;

cin>>cNum;

int MN;

MN = Employee::MaxNum();

for(int i=0;i

{

if(Enum[i] == cNum)

{

Employee::shownum(cNum);

cout<<“请输入该职工的新信息: ”<

cout<<“职工姓名: ”;//录入职工的新的数据,职工编号保持不变

cin>>Employee::Employeename;

Ename[i] = Employee::Employeename;

cout<<“职工性别(F为女性,M为男性): ”;

cin>>Employee::Employeesex;

Esex[i] = Employee::Employeesex;

cout<<“职工年龄: ”;

cin>>Employee::Employeeage;

Eage[i] = Employee::Employeeage;

cout<<“职工婚姻状况(Y为已婚,N为未婚): ”;

cin>>Employee::Employeemarriage;

Emarriage[i] = Employee::Employeemarriage;

cout<<“职工学历,请输入相应学历的序号:”<

cout<<“ [1:小学 2:初中 3:高中 4:本科 5:硕士 6:博士] ”;

cin>>Employee::Employeedegree;

while(Employee::Employeedegree!=1&&Employee::Employeedegree!=2&&Employee::Employeedegree!=3&&Employee::Employeedegree!=4&&Employee::Employeedegree!=5&&Employee::Employeedegree!=6)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:小学 2:初中 3:高中 4:本科 5:硕士 6:博士] ”;

cin>>Employee::Employeedegree;

}

Edegree[i] = Employee::Employeedegree;

cout<<“职工所在部门,请输入相应部门的序号: ”<

cout<<“ [1:董事会 2:销售部 3:人事部 4:客服中心 5:财务部 6:技术研发部 7:安全监察部] ”;

cin>>Employee::Employeedepart;

while(Employee::Employeedepart!=1&&Employee::Employeedepart!=2&&Employee::Employeedepart!=3&&Employee::Employeedepart!=4&&Employee::Employeedepart!=5&&Employee::Employeedepart!=6&&Employee::Employeedepart!=7)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:董事会 2:销售部 3:人事部 4:客服中心 5:财务部 6:技术研发部 7:安全监察部] ”;

cin>>Employee::Employeedepart;

}

Edepart[i] = Employee::Employeedepart;

cout<<“职工职位,请输入相应职位的序号:”<

cout<<“ [1:临时职员 2: 正式职员 3:部门经理 4:主任 5:董事长] ”;

cin>>Employee::Employeeposition;

while(Employee::Employeeposition!=1&&Employee::Employeeposition!=2&&Employee::Employeeposition!=3&&Employee::Employeeposition!=4&&Employee::Employeeposition!=5)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:临时职员 2: 正式职员 3:部门经理 4:主任 5:董事长] ”;

cin>>Employee::Employeeposition;

}

Eposition[i] = Employee::Employeeposition;

cout<<“员工的工作时(不需要输入单位): ”;

cin>>Employee::Employeeworktime;

Eworktime[i] = Employee::Employeeworktime;

Epay[i] = Employee::Pay(Employee::Employeeposition);

break;

}

}

dbo.WriteIn(0);}

void Employee::DeleteInfo()//删除职工数据的函数

{

char tmp;

int cNum = 1000;

DBOperate dbo;

dbo.ReadOut();

void Employee::shownum(long number);

cout<<“请输入您要删除的职工编号>: ”;

cin>>cNum;

int MN;

MN = Employee::MaxNum();

for(int i=0;i

{

if(Enum[i] == cNum)

Employee::shownum(cNum);

}

cout<<“确认要删除该职工信息?(Y为确认,N为放弃): ”;

cin>>tmp;

if(tmp=='Y')

{

if(i==MN-1)

dbo.WriteIn(-1);

else

{

for(int j=i;j

{ Enum[j] = Enum[j+1];}

dbo.WriteIn(-1);

}

cout<<“ 删除操作成功!”<

} }

float Employee::Pay(int Employeeposition)//根据职工职位计算工资的函数

{

float tmpPay;

tmpPay = Employee::EmployeeBasePay + Employee::Employeeposition Employee::EmployeeBasePay;

*

return tmpPay;}

void DBOperate::WriteIn(int iflag)//数据操作函数—写入

{

DBOperate::RefreshMaxNum(iflag);

ofstream myf(“Employee.txt”);

Employee e;

int MN;

MN = e.MaxNum();

for(int i=0;i

{

myf<

}

myf.close();

return;}

void DBOperate::ReadOut()//数据操作函数—读出

{

ifstream myf(“Employee.txt”);

Employee e;

int MN;

MN = e.MaxNum();

for(int i=0;i

{

myf>>DBOperate::Employeenum>>DBOperate::Employeename>>DBOperate::Employeesex>>DBOperate::Employeeage>>DBOperate::Employeemarriage

>>DBOperate::Employeedegree>>DBOperate::Employeedepart>>DBOperate::Employeeposition>>DBOperate::Employeeworktime>>DBOperate::Employeepay;

Enum[i] = DBOperate::Employeenum;

Ename[i] = DBOperate::Employeename;

Esex[i] = DBOperate::Employeesex;

Eage[i] = DBOperate::Employeeage;

Emarriage[i] = DBOperate::Employeemarriage;

Edegree[i] = DBOperate::Employeedegree;

Edepart[i] = DBOperate::Employeedepart;

Eposition[i] = DBOperate::Employeeposition;

Eworktime[i] = DBOperate::Employeeworktime;

Epay[i] = DBOperate::Employeepay;

}

myf.close();}

void DBOperate::RefreshMaxNum(int iflag)//更新系统中员工计数文件的函数

{

int MaxNum = 0;

ifstream myif(“EmployeeMaxNum.txt”);

myif>>MaxNum;

myif.close();

MaxNum = MaxNum+iflag;

ofstream myof(“EmployeeMaxNum.txt”);

myof<

myof.close();}

int main()//主函数

{

system(“color B0”);//设置当前窗口的背景色和前景色

// 0 = 黑色

= 灰色

// 1 = 蓝色

= 淡蓝色

// 2 = 绿色

A = 淡绿色

// 3 = 浅绿色 B = 淡浅绿色

// 4 = 红色

C = 淡红色

// 5 = 紫色

D = 淡紫色

// 6 = 黄色

E = 淡黄色

// 7 = 白色

F = 亮白色

int select = 0;

while(select!=5)

{

cout<<“ ╭————————————————————————————╮”<

cout<<“ ∣

《主菜单》

∣”<

cout<<“ ├————————————————————————————┤”<

cout<<“ ∣

1.新建并录入职工信息

∣”<

cout<<“ ∣

2.按条件输出职工信息

∣”<

cout<<“ ∣

3.修改指定职工的信息

∣”<

cout<<“ ∣

4.删除职工信息

∣”<

cout<<“ ∣

5.退出系统

∣”<

cout<<“ ╰————————————————————————————╯”<

cout<<“ ——————————————————————————————”<

cout<<“ 请选择您需要功能的代号: ”;

cin>>select;

Employee e;

DBOperate dbo;

switch(select)

{

case 1:

e.NewInfo();break;

case 2:

dbo.ReadOut();

e.ShowInfo();break;

case 3:

e.RefreshInfo();break;

case 4:

e.DeleteInfo();break;

case 5: cout<<“ 退出成功”<

default: cout<<“命令错误!”<

}

if(select == 5)

break;

}

exit(1);

return 0;}

第三篇:航空售票系统+C++课程设计源代码

#include #include #define M 5//每种飞机票的总数目 #define N 3//飞机票的总数目 class Plane {private: char name[40];//终点站名

int number;//航班号

int Number;//飞机号

int week;//星期几飞行

int day;//日期

int left;//余票额

int n;//与数组flag一起确定客户订票状态 public:

int flag[20];//订票状态数组,-1为预订票,1为已定票,0为初始化状态

Plane()//构造函数

{

name[0]='';

number=0;

Number=0;

week=0;

day=0;

left=M;

n=0;//数组从0开始计数

for(int i=0;i<20;i++)

flag[i]=0;} void init()//初始化每种飞机票

{

cout<<“请输入终点站名:”;

cin>>name;

cout<<“请输入航班号:”;

cin>>number;

cout<<“请输入飞机号:”;

cin>>Number;

cout<<“请输入星期几飞行:”;

cin>>week;

cout<<“请输入航班的日期:”;

cin>>day;} ~Plane(){};//析构函数 char *getname(){return name;}//获得终点站名

int getnumber(){return number;}//获得航班号

int getNumber(){return Number;}//获得飞机号

int getweek(){return week;}//获得星期几飞行

int getday(){return day;}//获得日期

int getleft(){return left;}//获得余票额

int getn(){return n;}//获得旅客数目

void inleft(int n){left=left+n;}//余票额增加函数

void deleft(int n){left=left-n;}//余票额减少函数

void inn(){n++;}//旅客数目增加函数 };Plane pl[N];int showmenu();//菜单函数 void start();//初始化函数 void query();//查询函数 void make();//订票函数 void back();//退票函数 int main(){ cout<<“这是民航售票处的计算机系统程序”<

int choice;

choice=showmenu();

switch(choice)

{

case 1:query();break;

case 2:make();break;

case 3:back();break;

case 0:return 0;

default:cout<<“你敲错了!n”;

} } return 0;} int showmenu(){ int ch;cout<>ch;return ch;} void start(){ for(int i=0;i

pl[i].init();

cout<>name;for(i=0;i<=N;i++)

if(strcmp(name,pl[i].getname())==0)

{

num++;

cout<<“航班号:”<

cout<<“飞机号:”<

cout<<“星期:”<

cout<<“航班日期:”<

cout<<“余票额:”<

break;

}

if(num==0)

cout<<“没有此航班”<>number;cout<<“请输入订票数额:”;cin>>n;for(int i=0;i

if(number==pl[i].getnumber())

{

num++;

if(n<=pl[i].getleft())

{

cout<<“此航班有票”<

pl[i].deleft(n);

pl[i].inn();

pl[i].flag[pl[i].getn()]=1;

for(i=0;i

{

cout<<“座位号”;

cin>>sitnumber;

}

}

else

{

cout<<“余票额少于订票额,请重新输入订票数额,”<<“订票数额应该少于或等于”<

cin>>nu;

if(nu<=pl[i].getleft())

{

cout<<“此航班有票”<

pl[i].deleft(nu);

pl[i].inn();

pl[i].flag[pl[i].getn()]=1;

for(i=0;i

{

cout<<“座位号”;

cin>>sitnumber;

}

}

else

{

cout<<“是否需要预约”<

cout<<“是(1)

否(2)”<

cin>>ch;

switch(ch)

{

case 1:pl[i].inn();pl[i].flag[pl[i].getn()]=-1;break;

case 2:break;

default:cout<<“你敲错了!”<

}

}

}

}

if(num==0)

cout<<“没有此航班”<

cout<<“请输入日期:”;cin>>day;cout<<“请输入航班:”;cin>>number;for(int i=0;i

if((day==pl[i].getday())&&(number==pl[i].getnumber()))//日期与航班是否满足

{

num++;//日期与航班满足

cout<<“输入退票数目”;

cin>>n;

cout<<“退票成功”<

pl[i].inleft(n);//该种飞机票增加,即已退票

for(int j=0;j<=pl[i].getn();j++)//顺序查询客户订票状态

{

if(pl[i].flag[j]==-1)//客户是否为预定状态

{

cout<<“有预约订票,请输入订票数额:”;

cin>>nu;

if(nu<=pl[i].getleft())//余票额是否满足要求

{

cout<<“此航班有票”<

pl[i].flag[j]=1;

cout<<“订票成功”<

pl[i].deleft(nu);

for(int k=0;k

{

}

cout<<“座位号”<<“ ”;

cin>>sitnumber;

}

cout<<“余票额为”<

}

}

else

cout<<“没有预约订票!”<<“余票额为”<

第四篇:c++课程设计:教务管理系统源代码

#include #include using namespace std;class Person { public: Person(string n):name(n){} virtual void show(){} ~Person(){} protected:

string name;};class Student:public Person { public:

Student(string n,int num,string ss):Person(n),number(num),address(add),str1(ss){}

virtual void show();

void input_stu();

void display_stu();

void display_qu();

~Student(){} protected:

string str1;

int number;

string address;};void Student::show(){ cout<<“向老师提出的问题是:”;cin>>str1;}

void Student::display_qu(){ cout<

void Student::input_stu(){ cin>>Student::name;cin>>Student::number;cin>>Student::address;} void Student::display_stu(){

add,string cout<<“姓名:”<

Teacher(string n,string sub,string sdf):Person(n),subject(sub),str2(sdf){}

virtual void show();

void input_t();

void display_t();

void display_an();

~Teacher(){} protected:

string subject;

string str2;};void Teacher::display_an(){ cout<

void Teacher::show(){ cout<<“我的回答是:”;cin>>str2;} void Teacher::input_t(){ cin>>Teacher::name;cin>>Teacher::subject;} void Teacher::display_t(){ cout<<“姓名:”<

Admin(string n,int tel,string ssfs):Person(n),telphone(tel),str3(ssfs){}

virtual void show();

void input_ad();

void display_ad();

void display_gg();

~Admin(){} protected:

int telphone;

string str3;};void Admin::display_gg(){ cout<<“公告:”;cout<

void Admin::show(){

cout<<“公告是:”;cin>>str3;} void Admin::input_ad(){ cin>>Admin::name;cin>>Admin::telphone;} void Admin::display_ad(){ cout<<“姓名是:”<

int main(){ int z,h,m;z=0;h=0;m=0;

Student stu(“guochun”,20150311,“qlu”,“sdss”);

Teacher tea(“cuiyu”,“math”,“dsdf”);

Admin ad(“steve jobs”,178641,“sdfs”);

while(1)

{

int x;

cout<<“*******************”<

cout<<“1.学生”<

cout<<“2.教师”<

cout<<“3.管理员”<

cout<<“*******************”<

cout<<“选择你的身份”<

cin>>x;

if(x<=0||x>3)

cout<<“输入错误!”<

else

{

switch(x)

{

case 1:

cout<<“请选择你要干什么”<>y;if(y<=0||y>3)cout<<“发生错误!”;else { switch(y){

case 1:stu.display_stu();break;

case 2:stu.input_stu();

} cout<<“修改后的个人信息为:”<

{

stu.Student::show();

z=1;} break;

}

break;

case 2:

cout<<“请选择你要干什么”<

cout<<“学生有问题提问”<

ad.display_gg();} cout<<“___________________”<>q;if(q<=0||q>3)

cout<<“发生错误!”;else {

switch(q)

{

case 1:tea.display_t();break;

case 2:tea.input_t();

cout<<“修改后的个人信息为:”<

tea.display_t();break;

case 3:

{

if(z==1)

{

cout<<“学生的问题是:”;

stu.display_qu();

tea.Teacher::show();

h=1;

}

}

break;

}

}

break;

case 3:

cout<<“请选择你要干什么”<

cout<<“___________________”<

cout<<“1.显示个人信息”<>l;if(l<=0||l>3)

cout<<“发生错误!”;

else

{

switch(l)

{

case 1:ad.display_ad();break;

case 2:ad.input_ad();

cout<<“修改后的个人信息为:”<

ad.display_ad();break;

case 3:

{

ad.Admin::show();

m=1;

}

break;

}

}

break;

}

}

}

return 0;}

第五篇:C++课程设计学生信息管理系统

C++程序设计实践教学环节任务书

一、题目:学生信息管理系统

二、目的与要求

1.目的:

(1)掌握面向对象程序设计的基本思路和方法;

(2)了解系统开发的需求分析、类层次设计、模块分解、编码测试、模块

组装与整体调试的全过程;

(3)进一步熟悉C++中类的概念、类的封装、继承的实现方式;(4)学会分析简单的实际问题,并能利用所学的知识建立系统的逻辑结构,学会简单的调试技巧和方法。逐步熟悉面向对象程序设计的方法,养成良好的编程习惯。

2.要求基本要求:

(1)要求利用C++面向对象的编程思想来完成系统的设计;(2)进行简单界面设计,能够实现友好的交互;(3)具有清晰的程序流程图和数据结构的详细定义;(4)熟练掌握C++对文件的各种操作。

三、信息描述

有关该系统基本信息的描述(如:学号、姓名、系别、班级和各科成绩等)。

四、功能描述

1.添加、删除

系统将提示用户输入新添加学生的信息;由用户输入要删除的学生的学号,然后调用删除函数,删除该名学生的资料。2.查找

首先由用户输入要查找的学生的学号,系统用查找函数查找,然后系统就调用输出函数。

3.修改

首先由用户输入要修改的学生的学号,然后系统用修改函数查找,显示该名学生的资料,然后系统提示用户输入需要修改的项目和新的资料。4.界面要求

开始登录管理界面、主要提示菜单界面(提示用户执行何种操作)等。

五、解决方案

1.分析程序的功能要求,划分程序功能模块。2.画出系统流程图。

3.代码的编写、程序的功能调试。4.完成系统总结报告以及使用说明书

六、进度安排

此次课程设计时间为一周或两周,分四个阶段完成:

1.分析设计阶段。指导教师应积极引导学生自主学习和钻研问题,明确

设计要求,找出实现方法,按照需求分析、总体设计、详细设计这几个步骤进行。

2.编码调试阶段:根据设计分析方案编写代码,然后调试该代码,实现

课题要求的功能。

3.总结报告阶段:总结设计工作,写出课程设计说明书,要求学生写出需

求分析、总体设计、详细设计、编码、测试的步骤和内容。4.考核阶段。

七、撰写课程设计报告或课程设计总结

总结报告包括需求分析、总体设计、详细设计、编码(详细写出编程步骤)、测试的步骤和内容、课程设计总结、参考资料等,不符合以上要求者,则本次设计以不及格记。

八、参考资料

《C++语言程序设计教程》

网上相关资料(....略)

下载C++课程设计 教职工信息管理系统源代码word格式文档
下载C++课程设计 教职工信息管理系统源代码.doc
将本文档下载到自己电脑,方便修改和收藏,请勿使用迅雷等下载。
点此处下载文档

文档为doc格式


声明:本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:645879355@qq.com 进行举报,并提供相关证据,工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。

相关范文推荐

    职工信息管理系统源代码

    #include #include #include int N=2; struct worker/*定义一个职工信息的结构体*/ { intnum; /*定义一个职工信息的结构体*/ char name[20]; /*定义一个职工信息的结构......

    学生信息管理系统源代码

    学生信息管理系统源代码 import java.io.*; class StuInfo { public String name; public int number; public String sex; public String age; public String bir; public......

    简单学生信息管理系统C++范文

    #include #include using namespace std; int i=0; void layout() { cout......

    C++程序设计课程设计人口户籍信息管理系统源程序

    九、源程序代码 #include #include #include #include//kj;lj;j;j; class population { private: int maxnum;//人口户籍编号最大值r int sno;//编号 char name[20]; char......

    c++学校人员信息管理系统

    1.C++课程设计题目:《学校人员信息管理系统》 用c++设计一个大学教师和学生管理程序,教师包括编号(a),姓名(c),职称(d)和教研室数据(b)的数据输入输出; 大学生包括编号(m),......

    VB学生信息管理系统及源代码(5篇)

    VB学生信息管理系统及源代码 Option Explicit '标识是否能关闭 Dim mbClose As Boolean '标识当前要显示的照片的文件 Dim mstrFileName As String Private Sub Form_Load(......

    【课程设计】职工信息管理系统

    题目:职工信息系统 功能包括:  建立职工信息数据(职工编号,姓名,性别,年龄,电话,职务,工资和家庭成员信息)和信息简表(编号,姓名,电话)  根据职工编号查询职工信息(查询时需要身份确认......

    C++课程设计公司人事管理系统

    C++程序设计实践教学环节任务书 承接的项目额(10%)提成,业务经理既拿固定月薪(2000元)也领取提成,财务人员固定工资(2000元),文秘为固定工资(1500元)。 (4) 可按姓名显示、查找、......