当前位置:文档之家› 职工工资管理系统程序

职工工资管理系统程序

职工工资管理系统程序
职工工资管理系统程序

编写一个职工工资管理系统程序,该程序输入职工工号和应发工资,由系统对其完成的实发工资实现计算。

其中职工信息包括职工号、姓名、性别、应发工资、税金、实发工资等(职工号不重复)。

功能要求及说明:

系统以菜单方式工作

职工基本信息和应发工资的录入功能(用文件保存)

从键盘输入数据,建立磁盘数据文件

职工工资信息浏览功能:

从磁盘数据文件读取所有职工工资信息并显示输出到屏幕上;

计算应发工资和查询的功能:

计算公式为:税金=应发工资*税率;

实发工资=应发工资-税金;

应发工资税率

<1000 0

1000~4999 5%

5000以上 10%

其中

源代码:

#include

et() ;

ut() ;

cout << endl ;

}

break ;

case 3:

{

int p=0 ;

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

cout << "#" ;

cout << setw(20) << "查询应发工资\n" ;

for(int j=0;j<80;j++)

cout << "#" ;

int number ;

cout << "\n输入你要查询的职工号:" ;

cin >> number ;

for (int m=0;m

if( person[m].check(number,2) )

{

cout << "\n找到了!\n" ;

person[m].put () ;

p=1 ;

break;

}

if(p==0)

cout << "\n没有这个工号!\n" ; }

break ;

default:

cout << "\n输入错误!" ;

}

cout << "\n是否继续察看主菜单?(y or n):" ;

cin >> choose2 ;

}while(choose2=='y') ;

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

person[i].put_txt ( out ) ;

closing ( in , out ) ;

return 0 ;

}

void opening ( ifstream& ins , ofstream& outs ) {

("c:\\tc\\tc\\s a l a r " ) ;

if ())

{

cout << "wo can not open !" ;

exit (1);

}

("c:\\tc\\tc\\s a l a r " ) ;

if ())

{

cout << "wo con not opening s a l a r !" ;

exit (1);

}

}

void closing ( ifstream& ins , ofstream& outs ) {

();

();

}

int show_menu ()

{

int word ;

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

cout << "#" ;

cout << "1. 职工基本信息和应发工资的录入; \n" ; cout << "2.职工工资信息浏览; \n" ;

cout << "3.查询应发工资; \n" ;

for(int j=0;j<80;j++)

cout << "#" ;

cout << "请你输入选择的项目的代码(1,2...) :" ;

cin >> word ;

return word ;

}

void Person::change_pay()

{

if(pay<1000)

{

pay_out = 0 ;

pay_true = pay ;

}

if( (pay<4999) && (pay>=1000) ) {

pay_out = pay* ;

pay_true = pay - pay_out ; }

if(pay>=5000)

{

pay_out = pay* ;

pay_true = pay - pay_out ; }

}

void Person::come(ifstream& in) {

char b ;

(b) ;

if(b==':')

in >> number ;

a[Count]=number ;

do

{

(b) ;

}while(b!=':') ;

if(b==':')

in >> name ;

do

{

(b) ;

}while(b!=':') ;

in >> pay ;

do

{

(b) ;

}while(b!=':') ;

in >> pay_out ;

do

{

(b) ;

}while(b!=':') ;

in >> pay_true;

}

void Person::get()

{

do

{

cout << "\n职工号:" ;

cin >> number ;

a[Count]=number ;

if( check(number,1) )

break ;

cout << "\n职工号有重复,请重新输入!" ; }while(1);

cout << "\n姓名:" ;

cin >> name;

cout << "\n应发工资:" ;

cin >> pay ;

}

void Person::put()

{

change_pay() ;

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

cout << "#" ;

cout << "\n职工号:" << number

<< "\n姓名:" << name

<< "\n应发工资:" << pay

<< "\n税金:" << pay_out

<< "\n实发工资:" << pay_true ; cout << endl ;

}

void Person::put_txt( ofstream& out ) {

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

cout << "#" ;

out << "\n职工号:" << number

<< "\n姓名:" << name

<< "\n应发工资:" << pay

<< "\n税金:" << pay_out

<< "\n实发工资:" << pay_true ; }

bool Person::check( int b , int choose) {

switch(choose)

{

case 1:

{

for(int i=0;i

if(b == a[i])

return (b!=a[i]) ;

return 1 ;

}

case 2:

return (b==number) ; default:

cout << "\n系统错误!" ;

exit(1) ;

}

}

相关主题
文本预览
相关文档 最新文档