c语言工资管理系统源代码天涯论坛,求c语言工资管理系统的源代码?
该程序输入职工工号和应发工资,由系统对其完成的实发工资实现计算。
其中职工信息包括职工号、姓名、性别、应发工资、税金、实发工资等(职工号不重复)。
功能要求及说明:
系统以菜单方式工作
职工基本信息和应发工资的录入功能(用文件保存)
从键盘输入数据,建立磁盘数据文件salary.txt
职工工资信息浏览功能:
从磁盘数据文件读取所有职工工资信息并显示输出到屏幕上;
计算应发工资和查询的功能:
计算公式为: 税金=应发工资*税率;
实发工资=应发工资-税金;
应发工资 税率
<1000 0
1000~4999 5%
5000以上 10%
源代码:
#include
//#include
#include
#include
#include
#include
using namespace std ;
const int fr = 10 ;
int a[fr] ;
//vector 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 ) ;
int choose1 ; //选择主菜单
char choose2 ; //选择是否退出
// vector person ;
Person person[100] ;
while(!in.eof())
{
char b ;
in.get(b) ;
if(b==':')
{
in.putback(b) ;
person[Count].come(in) ;
Count++ ;
}
}
do
{
system ("cls") ;
choose1=show_menu() ;
system ("cls") ;
switch(choose1)
{
case 1:
{
for(int i=0;i<80;i++)
cout << "#" ;
cout << setw(20) << "职工基本信息和应发工资的录入\n" ;
for(int j=0;j<80;j++)
cout << "#" ;
do
{
//a.push_back(0) ;
person[Count].get() ;
//person.push_back(0) ;
Count++ ;
cout << "\n是否继续录入?(y or n):" ;
cin >> choose2 ;
}while(choose2=='y');
}
break ;
case 2:
{
for(int i=0;i<80;i++)
cout << "#" ;
cout << setw(20) << "职工工资信息浏览\n" ;
for(int j=0;j<80;j++)
cout << "#" ;
cout << endl ;
for (int m=0;m
person[m].put() ;
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 )
{
ins.open("c:\\tc\\tc\\s a l a r y.txt" ) ;
if (ins.fail())
{
cout << "wo can not open salary.txt!" ;
exit (1);
}
outs.open("c:\\tc\\tc\\s a l a r y.txt" ) ;
if (outs.fail())
{
cout << "wo con not opening s a l a r y.txt!" ;
exit (1);
}
}
void closing ( ifstream& ins , ofstream& outs )
{
ins.close();
outs.close();
}
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*0.05 ;
pay_true = pay - pay_out ;
}
if(pay>=5000)
{
pay_out = pay*0.1 ;
pay_true = pay - pay_out ;
}
}
void Person::come(ifstream& in)
{
char b ;
in.get(b) ;
if(b==':')
in >> number ;
a[Count]=number ;
do
{
in.get(b) ;
}while(b!=':') ;
if(b==':')
in >> name ;
do
{
in.get(b) ;
}while(b!=':') ;
in >> pay ;
do
{
in.get(b) ;
}while(b!=':') ;
in >> pay_out ;
do
{
in.get(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) ;
}
}
◆◆
评论读取中....
请登录后再发表评论!
◆◆
修改失败,请稍后尝试
c语言工资管理系统源代码天涯论坛,求c语言工资管理系统的源代码?相关推荐
- C语言编译能否被七整除,求c语言高手输出1000以内既能被5整除又能被7整除
公告: 为响应国家净网行动,部分内容已经删除,感谢读者理解. 话题:求c语言高手 输出1000以内既能被5整除又能被7整除的数,要求五个数回答:int main(){int num =0;for(in ...
- C语言复杂的学生成绩管理系统,哭诉、拜求C语言学生成绩管理系统
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 /* Note:Your choice is C IDE */ #include "stdio.h" #include "s ...
- c语言推箱子源代码及注释,求大神 解析推箱子源代码 要详细
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 #include"stdio.h" #include"bios.h" #define LEFT 75 #defin ...
- c语言实现克鲁斯卡尔算法,跪求C语言代码纠错,急~~~,克鲁斯卡尔算法
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 程序可以运行,但是输入一半时会停止运行,极少数时能成功运行. #include #define MaxVertexNum 100 //最大顶点个数 #d ...
- c语言输入整数要求输出字符,求C语言 将输入整数转换成字符串输出!
#include #include int power(int a, int n) { return pow((double)a, n); } #define pow power int main() ...
- 为啥c语言一亚索就无法运行,求C语言高手《找错误》
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 ......... 都是小错误. #include #define N 10 struct city { char CityName[10]; long ...
- c语言字符串出现屯,高分跪求c语言从文件读取内容出现屯屯屯的问题
这是我的代码 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include typedef struct People //定 ...
- c语言工资管理系统输出错误,求c语言工资管理系统的源代码?
该程序输入职工工号和应发工资,由系统对其完成的实发工资实现计算. 其中职工信息包括职工号.姓名.性别.应发工资.税金.实发工资等(职工号不重复). 功能要求及说明: 系统以菜单方式工作 职工基本信息和 ...
- 员工婚姻信息表c语言编程,急!求C语言高手 职工工资管理系统 要求包含职工全部信息,包括编号 姓名 性别 生日 年龄 婚姻 住址 职称...
匿名用户 1级 2011-06-28 回答 #include "stdafx.h" #include "iostream" #include "str ...
最新文章
- Linux 的内存管理工具和调优参数
- Flink升级到1.4版本遇到的坑
- Python全栈 MySQL 数据库 (索引、数据导入、导出)
- MySQL 如何复制表
- Oracle所有分析函数转
- 【转载】100多个很有用的JavaScript函数以及基础写法大集合
- ant 时 --java.lang.NoSuchMethodError: org.apache.tools.ant.util.FileUtils.getFileUtils 解决方法
- progressbar使用方法:进度画面大小,进度画面背景,进度百分比
- WPF TreeView tools
- adb工具包_如何使用命令刷机 ADB与FASTBOOT工具使用教程
- jsp 九大内置对象详解以及示例
- linux mentohust dhcp,校园网锐捷 openwrt mentohust 成功开启IPv6
- 用Matlab的FDAtool生成IIR滤波器参数
- 怎么用python电商文本挖掘?(5)
- iOS App构建版本
- 苹果手机用android,用习惯了苹果手机还能从苹果换到安卓吗?
- 【金猿投融展】齐治科技——数据中心安全管理领军者
- redis(五)跳跃表
- 苹果4s怎么越狱_【爆料】大神把苹果手机刷入了安卓系统!
- font-spider 压缩字体文件 html vue