سورس کد پروژه حقوق و دستمزد به زبان سی پلاس پلاس
در این پست سورس کد پروژه حقوق و دستمزد به زبان سی پلاس پلاس را برایتان آماده کرده ایم که با نهایت کیفیت برنامه نویسی شده است.توجه داشته باشید که می توانید استفاده های مختلفی از این پروژه داشته باشید.این پروژه داده های دریافتی را در قالب یک فایل txt ذخیره می کند.از امکانات این پروژه می توان به مدیریت حقوق دستمزد ، محاسبه تاریخ کارکرد و… اشاره نمود.بعلاوه می توانید سورس کد پروژه دریافت تاریخ و نمایش سن به زبان سی پلاس پلاس را نیز از سایت دریافت نمایید.
#include <iostream> #include <fstream> #include <cstdlib> #include <iomanip> using namespace std; void EmployeeInfo (); void input(); void printstars (); void paycompute(); void date_coverage(); //global variables string E_code,E_name,E_record,E_level,d_coverage;; double perday,T_Hours,T_Mins; int main(){ do{ system("cls"); //Accept input from user cout<<"Enter Employee ID: "; getline(cin,E_code); // opens file for input ifstream inFile("employee.txt",ios::in); // if input file can not be open enter the fail state if(!inFile) { cout << "Can not open input file" << endl; cout << "The program will terminate" << endl; system("pause"); exit(0); } //search for employee code do{ getline(inFile,E_record); int location = E_record.find(E_code); if(location>0) { E_code = E_record.substr(location,8); E_level = E_record.substr(E_record.length()-1,1); E_name = E_record.substr(0,location-1); break; } }while(!inFile.eof()); if (E_level =="1") perday = 380; if (E_level =="2") perday = 450; if (E_level =="3") perday = 550; //Display Records if (E_name==""){ cout<<"Record not Found!\n\n\n"; system("pause"); exit(0); } else { EmployeeInfo (); input(); date_coverage(); EmployeeInfo (); paycompute(); cout<<"\n\n"; system("Pause"); } }while(true); }//END //MY USER-DEFINED FUNCTIONS void EmployeeInfo (){ system("cls"); printstars (); cout<<"\n\nEmployee Name :\t"<<E_name; cout<<"\nEmployee Code :\t"<<E_code; cout<<"\nEmployee Level:\t"<<"Level "<<E_level; cout<<"\nEmployee Rate :\t"<<"Php"<<perday<<".00/day"; printstars (); } void input () { // declare variables -------- int hrs_in[5],hrs_out[5], min_in[5],min_out[5],x,TH_inout[5]; char colon; string days []={"Monday","Tuesday","Wednesday","Thursday","Friday"}; // accept input ------- cout<<"\n\nEnter the time using the following format(hour:minutes)\n"; for(x=0;x<5;x++){ cout<<"\n\nEnter Log-in for "<<days[x]<<" : "; cin>>hrs_in[x]>>colon>>min_in[x]; cout<<"Enter Log-out for "<<days[x]<<" : "; cin>>hrs_out[x]>>colon>>min_out[x]; } //write data to text files ------------ ofstream out("dtr.txt",ios::out); out<<E_code; for(x=0;x<5;x++){ out<<","<<hrs_in[x]<<":"<<min_in[x]<<","<<hrs_out[x]<<":"<<min_out[x]; } // out<<"\n\nTotal Working Hours: "<<T_Hours<<" Hrs"; cout<<"Files successfully written to dtr.txt files!"; cout<<"\n\n"; system("pause"); //compute number of Total Hours and Minutes -------- for(x=0;x<5;x++){ if(hrs_in[x]<8) {hrs_in[x]=8; min_in[x]=00; } if(hrs_in[x]>=12 && hrs_in[x]<13) { hrs_in[x]=13; min_in[x]=00; } if(hrs_in[x]>=12 && hrs_in[x]<=13) {TH_inout[x] = (hrs_out[x]-hrs_in[x]);} else {TH_inout[x] = (hrs_out[x]-hrs_in[x])-1;} T_Hours =T_Hours+TH_inout[x]; } } void printstars (){ cout<<"\n================================================="; } void date_coverage(){ system("cls"); printstars(); cout<<"\nEnter Payroll Date of Coverage: "; getline(cin,d_coverage); getline(cin,d_coverage); } void paycompute(){ cout<<"\n\nDate of Coverage\t: "<<d_coverage; cout<<"\nTotal Work Hours\t: "<<T_Hours<<".00 Hrs"; cout<<"\nWeekly Regular Salary\t: "<<"Php"<<((T_Hours/8)*perday)<<".00"; cout<<"\n"; printstars (); cout<<"\n\n"; }
دیدگاه کاربران
تعداد دیدگاه های کاربران : ۰ دیدگاه