c++课程设计

8、实现一个工资管理系统

系统的主要功能是计算职工当月工资并要求存档案

公司是一个不大不小公司,职工有种5类型,他们是技术人员,销售人员,文秘,技术经理,销售经理。世界从来就不是公平的,在公司内部也一样,不同职位工资不同。

技术人员工资是按小时算,薪酬为40元。销售人员工资是按销售提成,月工资为销售总额的5%。文秘为有4000元底薪,奖金要看当月的工作情况而定。技术经理和销售经理,均有每月5000元固定工资。技术经理工作业绩分为三个等级,每级有1000元奖金,销售经理资金由他管理团队销售业绩而定,为总经额的0.3%




#include<iostream>
#include<fstream>
using namespace std;
int main()
{   
	ofstream ofile;
	ifstream ifile;
	ofile.open("d:\\fileIn.txt");
    int type,score;
    float time,salary,a_salary,b_salary,wages,commissions,bonus,sum_salary; 
    printf("请输入职位类型:\n");
    scanf("%d",&type);
	ofile<<type;
    switch(type){
    case 1:{
		    ;

	        cout<<"score=";
	        cin>>score;
		    if(score>2)wages=8000;
			else if (score>1)wages=7000;      
			else if(score>0)wages=6000;
			
			cout<<"该月所得工资为:"<<wages<<endl;
			ofile<<wages;
			ofile.close();
			cout<<"\n读出文件内容"<<endl;
			ifile.open("d:\\fileIn.txt");
			ifile>>wages;
			while(!ifile.eof())
			{
				cout<<wages;
				ifile>>wages;
			}
			ifile.close();
			break;}
    
    
    case 2:{
            cout<<"请输入工作时间:\n";
            cin>>time;
			ofile<<time;
			cout<<"请输入每小时的薪水:\n";
            cin>>salary;
			ofile<<salary;
			wages=time*salary;
			ofile<<wages;
			cout<<"该月所得工资为:"<<wages<<endl;
			ofile<<wages;
			ofile.close();
			cout<<"\n读出文件内容"<<endl;
			ifile.open("d:\\fileIn.txt");
			ifile>>wages;
			while(!ifile.eof())
			{
				cout<<wages;
				ifile>>wages;
			}
			ifile.close();
			break;
           }
    case 3:{
		    printf("请输入每月的底薪:\n");
            scanf("%f",&a_salary);
            printf("请输入销售提成:\n");
            scanf("%f",&commissions);
            wages=commissions*0.05;
			cout<<"该月所得工资为:"<<wages<<endl;break;
           }
    case 4:{
            printf("请输入每月的底薪:\n");
            scanf("%f",&b_salary);
			printf("请输入该月的奖金:\n");
			scanf("%f",&bonus);
            wages=b_salary+bonus;
            cout<<"该月所得工资为:"<<wages<<endl;break;
	}
	case 5:{
		    printf("请输入当月销售总额:\n");
            scanf("%f",&sum_salary);
            wages=sum_salary*0.0003;
            cout<<"该月所得工资为:"<<wages<<endl;break;
		

	}}
    return 0;	
	}

老师,我这个程序算工资是可以的,但是保存数据方面不太会,应该是要用到面向对象的内容,看了书本之后写了一小段上去,还是保存不了,能力有限了~


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值