#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#include<windows.h>
#include<time.h>
#include<iomanip>
#include<ctype.h>
#define max 50
using namespace std;
int num=0;
void gotoXY(int,int);
void Cdelay(int);
void border(int, int,int, int);
void borderNoDelay(int, int,int, int);
void loginFrame(int, int, int, int);
void intro();
void login();
void menu();
void insert();
void edit();
void editmenu();
void editname(int);
void editcode(int);
void editdes(int);
void editexp(int);
void editage(int);
void editsalary(int);
void list();
void deletes();
void search();
void setWindowSize(int,int);
void saverecords();
void getrecords();
bool isFilePresent();
void displayPayslip();
class employee
{
public:
char name[20];
int code;
char designation[20];
int exp;
int age;
int salary;
char AnyLoan;
int HRA;
int PF;
int tax;
int MealAllowance;
int TransportAllowance;
int MedicalAllowance;
int LoanBalance;
int LoanDebit;
int grosspay;
int workingHours;
int DA;
};
employee emp[max],tempemp[max];
void getrecords()
{
FILE *fp;
fp = fopen("Records.txt","r");
int c=0;
if(fp!=NULL)
{
while(feof(fp)==0)
{
fscanf(fp,"%s\t%d\t%s\t%d\t%d\t%d\t%c\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",&emp[c].name,&emp[c].code,&emp[c].designation,&emp[c].exp,&emp[c].age,&emp[c].salary,&emp[c].AnyLoan,&emp[c].HRA,&emp[c].PF,&emp[c].tax,&emp[c].MealAllowance,&emp[c].TransportAllowance,&emp[c].MedicalAllowance,&emp[c].LoanBalance,&emp[c].LoanDebit,&emp[c].grosspay,&emp[c].workingHours,&emp[c].DA);
c++;
}
num=c;
}
fclose(fp);
}
void saverecords()
{
if(num==0)
{
system("del Records.txt");
}
else
{
FILE *fp;
fp = fopen("Records.txt","w");
for(int i=0;i<num;i++)
{
fprintf(fp,"%s\t%d\t%s\t%d\t%d\t%d\t%c\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",emp[i].name,emp[i].code,emp[i].designation,emp[i].exp,emp[i].age,emp[i].salary,emp[i].AnyLoan,emp[i].HRA,emp[i].PF,emp[i].tax,emp[i].MealAllowance,emp[i].TransportAllowance,emp[i].MedicalAllowance,emp[i].LoanBalance,emp[i].LoanDebit,emp[i].grosspay,emp[i].workingHours,emp[i].DA);
}
fclose(fp);
}
}
void Cdelay(int msec)
{
long goal = msec + (clock());
while (goal > (clock()));
}
bool isFilePresent()
{
FILE *fp;
fp = fopen("Records.txt","r");
if(fp==NULL)
return false;
else
return true;
}
void loginFrame1(int xLenS = 18, int yLenS = 8, int xLenE = 55, int yLenE = 15)
{
system("cls");
gotoXY(xLenS,yLenS);printf("%c",201);
gotoXY(xLenS,yLenE);printf("%c",200);
for(int i=xLenS+1;i<=xLenE-1;i++) //Top and Bottom Border line
{
//Cdelay(0);
gotoXY(i,yLenS);
printf("%c",205);
//puts(style);
gotoXY(i,yLenE);
//puts(style);
printf("%c",205);
}
gotoXY(xLenE,yLenS);printf("%c",187);
gotoXY(xLenE,yLenE);printf("%c",188);
for(int i=yLenS+1;i<=yLenE-1;i++) //Left and Right Border Line
{
//Cdelay(20);
gotoXY(xLenS, i);
printf("%c",186);
//puts(style);
gotoXY(xLenE, i);
printf("%c",186);
//puts(style);
}
printf("\n\n");
}
void login()
{
char UserName[30],Password[30],ch;int i=0;
gotoXY(20,10);
printf("Enter UserName : ");
cin>>UserName;
gotoXY(20,12);
cout<<"Enter Password : ";
while(1)
{
ch = getch();
if(ch==13)
break;
if(ch==32||ch==9)
continue;
else
{
cout<<"*";
Password[i]=ch;
i++;
}
}
Password[i] = '\0';
if(strcmp(UserName,"admin")==0 && strcmp(Password,"admin")==0)
{
system("cls");
loginFrame1();
gotoXY(27,10);
cout<<"Login Success!!!";
gotoXY(21,12);
cout<<"Will be redirected in 3 Seconds...";
gotoXY(56,12);
Cdelay(1000);
gotoXY(44,12);
cout<<"\b \b2";
gotoXY(56,12);
Cdelay(1000);
gotoXY(44,12);
cout<<"\b \b1";
gotoXY(56,12);
Cdelay(1000);
}
else
{
system("cls");
loginFrame1();
gotoXY(27,10);
printf("Access Denied!!!\a");
gotoXY(21,12);
cout<<"Will be redirected in 3 Seconds...";
gotoXY(56,12);
Cdelay(1000);
gotoXY(44,12);
cout<<"\b \b2";
gotoXY(56,12);
Cdelay(1000);
gotoXY(44,12);
cout<<"\b \b1";
gotoXY(56,12);
Cdelay(1000);
system("cls");
loginFrame1();
login();
}
}
void setWindowSize(int width=670,int height=445)
{
HWND console = GetConsoleWindow();
RECT r;
GetWindowRect(console, &r);
MoveWindow(console, r.left, r.top, width, height, TRUE);
}
void gotoXY(int X, int Y)
{
COORD coordinates;
coordinates.X = X;
coordinates.Y = Y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coordinates);
}
void borderNoDelay(int xLenS = 2, int yLenS = 2,int xLenE = 76, int yLenE = 24 )
{
system("cls");
gotoXY(xLenS,yLenS);printf("%c",201);
gotoXY(xLenS,yLenE);printf("%c",200);
for(int i=xLenS+1;i<=xLenE-1;i++) //Top and Bottom Border line
{
gotoXY(i,yLenS);
printf("%c",205);
gotoXY(i,yLenE);
printf("%c",205);
}
gotoXY(xLenE,yLenS);printf("%c",187);
gotoXY(xLenE,yLenE);printf("%c",188);
for(int i=yLenS+1;i<=yLenE-1;i++) //Left and Right Border Line
{
gotoXY(xLenS, i);
printf("%c",186);
gotoXY(xLenE, i);
printf("%c",186);
}
printf("\n\n");
}
void border(int xLenS = 2, int yLenS = 2,int xLenE = 76, int yLenE = 22 )
{
system("cls");
gotoXY(xLenS,yLenS);printf("%c",201);
gotoXY(xLenS,yLenE);printf("%c",200);
for(int i=xLenS+1;i<=xLenE-1;i++) //Top and Bottom Border line
{
Cdelay(15);
gotoXY(i,yLenS);
printf("%c",205);
//puts(style);
gotoXY(i,yLenE);
//puts(style);
printf("%c",205);
}
gotoXY(xLenE,yLenS);printf("%c",187);
gotoXY(xLenE,yLenE);printf("%c",188);
for(int i=yLenS+1;i<=yLenE-1;i++) //Left and Right Border Line
{
Cdelay(15);
gotoXY(xLenS, i);
printf("%c",186);
//puts(style);
gotoXY(xLenE, i);
printf("%c",186);
//puts(style);
}
printf("\n\n");
}
void loginFrame(int xLenS = 18, int yLenS = 8, int xLenE = 55, int yLenE = 15)
{
border(xLenS,yLenS,xLenE,yLenE);
}
void insert()
{
borderNoDelay();
int i=num;
int sal,PF,TAX,HRA,MealA,MedicalA,TransportA,LoanBal,LoanDeb,h,DA;
char loan;
num+=1;
gotoXY(28,4);
printf("Insert New Record");
gotoXY(10,6);
cout<<"Name : ";
//cin.getline(emp[i].name,sizeof(emp[i].name));
cin>>emp[i].name;
gotoXY(10,8);
cout<<"Code : ";
cin>>emp[i].code;
gotoXY(10,10);
cout<<"Designation : ";
cin>>emp[i].designation;
gotoXY(10,12);
cout<<"Years of Experience : ";
cin>>emp[i].exp;
gotoXY(10,14);
cout<<"Age : ";
cin>>emp[i].age;
gotoXY(10,16);
cout<<"Enter Working Hours : ";
cin>>h;
sal = h*300;
emp[i].workingHours = h;
do
{
gotoXY(10,18);
cout<<"Any Loan (Y/N) ?: \b \b";
loan=getche();
if(loan=='Y'|| loan == 'y' || loan =='n' || loan == 'N')
C++ 薪资管理系统源代码
版权申诉
138 浏览量
2024-02-27
22:40:20
上传
评论
收藏 4KB ZIP 举报
新华
- 粉丝: 9611
- 资源: 610
最新资源
- 基于Javascript和Python的微商城项目设计源码 - MicroMall
- 基于Java的网上订餐系统设计源码 - online ordering system
- 基于Javascript的超级美眉网络资源管理应用模块设计源码
- 基于Typescript和PHP的编程知识储备库设计源码 - study-php
- Screenshot_2024-05-28-11-40-58-177_com.tencent.mm.jpg
- 基于Dart的Flutter小提琴调音器APP设计源码 - violinhelper
- 基于JavaScript和CSS的随寻订购网页设计源码 - web-order
- 基于MATLAB的声纹识别系统设计源码 - VoiceprintRecognition
- 基于Java的微服务插件集合设计源码 - wsy-plugins
- 基于Vue和微信小程序的监理日志系统设计源码 - supervisionLog
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈