该程序输入职工工号和应发工资,由系统对其完成的实发工资实现计算。
其中职工信息包括职工号、姓名、性别、应发工资、税金、实发工资等(职工号不重复)。
功能要求及说明:
系统以菜单方式工作
职工基本信息和应发工资的录入功能(用文件保存)
从键盘输入数据,建立磁盘数据文件salary.txt
职工工资信息浏览功能:
从磁盘数据文件读取所有职工工资信息并显示输出到屏幕上;
计算应发工资和查询的功能:
计算公式为: 税金=应发工资*税率;
实发工资=应发工资-税金;
应发工资 税率
<1000 0
1000~4999 5%
5000以上 10%
源代码:
#include <iostream>
//#include <string>
#include <iomanip>
#include <cstdlib>
#include <fstream>
#include <vector>
using namespace std ;
const int fr = 10 ;
int a[fr] ;
//vector<int> a ; //单独记录职工号
int Count=0 ; //计数器 计算一共有多少个员工
class Person
{
public:
bool check( int , int ) ; //检查职工号是否重复和查询职工号
void get() ; //得到数据
void put( ) ; //向显示屏输出
void put_txt(ofstream&); //向文本输出
void change_pay () ; //换算税金和应发工资
void come( ifstream& ) ; //从文本中 读取
private:
int number ; //职工号
char name[10] ; //姓名
char sex ; //性别
int pay ; //应发工资
double pay_out ; //税金
double pay_true ; //实发工资
};
void opening ( ifstream& , ofstream& );
void closing ( ifstream& , ofstream& );
int show_menu();
int main()
{
ifstream in ;
ofstream out ;
opening ( in , out ) ;