职工考勤管理系统

news/2025/3/20 2:19:02/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>#define PASS_WORD "123456"typedef struct _Stuff
{int no;//工号char name[20];//姓名struct tm * tm_strat;//上班时间struct tm * tm_end;//下班时间char state[20];//出勤状况
}Stuff,*PStuff;void Save_Info(PStuff mon,int n)
{int i;FILE* pFile = fopen("Mon_Info.dat","w");if(pFile==NULL){return;}for(i=0;i<n;i++){fwrite(&mon[i],1,sizeof(Stuff),pFile);}fclose(pFile);
}int Read_Info(PStuff mon)
{int i=0;FILE* pFile = fopen("Mon_Info.dat","r");if(pFile==NULL){return 0;}while(fread(&mon[i++],1,sizeof(Stuff),pFile));fclose(pFile);if(i>=1){return i-1;}return 0;
}int menu()
{int chioce;system("cls");printf("1:职工上班打卡\n");printf("2:职工下班打卡\n");printf("3:职工出勤情况\n");printf("4:按职工号查询\n");printf("5:按职工名查询\n");printf("6:考勤信息删除\n");printf("7:考勤信息修改\n");printf("8:退出\n");printf("请输入选择:");scanf("%d",&chioce);while(chioce<1||chioce>8){printf("请重新选择:");scanf("%d",&chioce);}	return chioce;
}void Print_Stuff(PStuff stu,int n)
{int i;system("cls");printf("%10s%10s%10s\n","工号","姓名","出勤");for(i=0;i<n;i++){printf("%10d",stu[i].no);printf("%10s",stu[i].name);printf("%10s\n",stu[i].state);}system("pause");
}void Modfiy_Menu(PStuff stu,int n)
{int i,temp;int chioce;char str[20];system("cls");printf("请输入要修改信息的职工号:");scanf("%d",&temp);for(i=0;i<n;i++){if(stu[i].no==temp){break;}}if(i==n){printf("无该职工号信息!\n");system("pause");return;}else{Print_Stuff(&stu[i],1);}printf("1:修改职工号\n");printf("2:修改职工姓名\n");printf("3:修改出勤情况\n");printf("0:返回\n");printf("请输入选择:");scanf("%d",&chioce);while(chioce<0||chioce>3){printf("请重新选择:");scanf("%d",&chioce);}	switch(chioce){case 1:printf("请输入新职工号:");scanf("%d",&stu[i].no);break;case 2:printf("请输入新职工名:");scanf("%s",&stu[i].name);break;case 3:printf("请输入新出勤情况:");scanf("%s",str);strcpy(stu[i].state,str);break;case 0:return ;break;}printf("修改成功!\n");Print_Stuff(&stu[i],1);
}struct tm * Set_Time()
{time_t tmpcal_ptr;  struct tm *tmp_ptr = NULL;  time(&tmpcal_ptr);tmp_ptr = gmtime(&tmpcal_ptr);   tmp_ptr = localtime(&tmpcal_ptr);printf ("%d.%d.%d ", (1900+tmp_ptr->tm_year), (1+tmp_ptr->tm_mon), tmp_ptr->tm_mday);  printf("%d:%d:%d\n", tmp_ptr->tm_hour, tmp_ptr->tm_min, tmp_ptr->tm_sec);return tmp_ptr;
}int Start_Work(PStuff stu,int n)
{system("cls");printf("请输入员工工号:");scanf("%d",&stu[n].no);printf("请输入员工姓名:");scanf("%s",stu[n].name);stu[n].tm_strat = Set_Time();stu[n].tm_end=NULL;if(stu[n].tm_strat->tm_hour >= 9){strcpy(stu[n].state,"迟到");}else{strcpy(stu[n].state,"全勤");}printf("上班打卡成功!\n");system("pause");return n+1;
}void End_Work(PStuff stu,int n)
{int temp,i;system("cls");printf("请输入员工工号:");scanf("%d",&temp);for(i=0;i<n;i++){if(temp==stu[i].no)break;}if(i==n){printf("无该职工号!\n");system("pause");return ;}if(stu[i].tm_end!=NULL){printf("下班打卡重复 本次无效!\n");system("pause");return;}stu[i].tm_end = Set_Time();if(stu[i].tm_end->tm_hour <= 17){strcat(stu[n].state,"早退");}printf("下班打卡成功!\n");system("pause");
}void Serach_Stuff(PStuff stu,int n)
{int i,temp;system("cls");printf("请输入要查询的职工号:");scanf("%d",&temp);for(i=0;i<n;i++){if(stu[i].no==temp){break;}}if(i==n){printf("无该职工号信息!\n");system("pause");}else{Print_Stuff(&stu[i],1);}
}void Serach_Stuff_Name(PStuff stu,int n)
{int i;char temp[20];system("cls");printf("请输入要查询的职工名:");scanf("%s",temp);for(i=0;i<n;i++){if(!strcmp(stu[i].name,temp)){break;}}if(i==n){printf("无该职工名信息!\n");system("pause");}else{Print_Stuff(&stu[i],1);}
}int Delete_Stuff(PStuff stu,int n)
{int i,num,j;char temp[20];system("cls");printf("请输入管理密码:");scanf("%s",temp);if(strcmp(temp,PASS_WORD)){printf("密码错误!\n");system("pause");return n;}printf("请输入要删除的工号:");scanf("%d",&num);for(i=0;i<n;i++){if(stu[i].no==num){break;}}if(i==n){printf("无该职工号信息!\n");system("pause");return n;}for(j=i;j<n;j++){stu[j]=stu[j+1];}printf("删除成功!\n");system("pause");return n-1;
}int main(int argc,char* argv[])
{int chioce;//记录选择Stuff stuff[100];//保存职工信息int NUM=0;//记录职工数量NUM=Read_Info(stuff);do{chioce=menu();switch(chioce){case 1:NUM = Start_Work(stuff,NUM);break;case 2:End_Work(stuff,NUM);break;case 3:Print_Stuff(stuff,NUM);break;case 4:Serach_Stuff(stuff,NUM);break;case 5:Serach_Stuff_Name(stuff,NUM);break;case 6:NUM=Delete_Stuff(stuff,NUM);break;case 7:Modfiy_Menu(stuff,NUM);break;case 8:Save_Info(stuff,NUM);exit(0);break;}}while(chioce!=8);return 0;
}

http://www.ppmy.cn/news/334675.html

相关文章

大亚DP607-G1破解超级管理员密码

nE7jA%5m 电信送的东西&#xff0c;问安装线路的&#xff0c;路由的无线可以用否&#xff1f;答曰&#xff1a;不能用。我心想&#xff1a;我明明看到有无线的标志&#xff0c;你说不能用&#xff1f;我就不信&#xff01; 1、用路由背后的用户名跟密码登陆 2、发现什么权限都…

公司员工考勤系统Java代码

package com.company;import java.util.List; import java.util.Scanner;public class Main {public static void main(String[] args) {Company company new Company();//添加员工company.addEmp(11,"zhangsan",20,男);company.addEmp(22,"lisi",22,男);…

利用wireshark和fiddler破解中控人脸识别考勤机

写在前面&#xff1a;若想实现篇中内容首先需要能接入考勤机所在网络 这篇的做法也算不上破解,只是一个作弊的小手段,拯救迟到党 单位装了中控刷脸考勤机&#xff0c;从机器这端考虑的话&#xff0c;刷脸比指纹更难破解了&#xff0c;毕竟每个人只有一张脸&#xff0c;不能用…

得力人脸识别考勤机密码设置_人脸指纹混合识别考勤机得力怎么使用

展开全部 具体步骤如下: ①安装好设备并给设备通电。 ②进32313133353236313431303231363533e59b9ee7ad9431333365666233入【设置】一栏就可以进行用户登记,人脸指纹登记、设置密码,分配权限。 ③然后进入进行用户验证,确认登记人脸、指纹、密码是否可用。 ④检查设备时间是…

中控考勤机管理员密码清除

破解管理员不影响考勤机里的任何数据。 这种方式适合彩屏机 须在1 分钟内按下列完成。 1、准备计算器&#xff0c;记下机器显示时间。 2、用计算器算出9999-机器显示时间的差的平方&#xff0c;就是密码。 eg.如你当前的时间是&#xff1a;20&#xff1a;32 9999-20327967 7967…

坚果Pro 电源键失效的处理

今天发现坚果Pro手机的电源键失效了 按照网上的建议操作如下&#xff1a; 关闭所有后台应用打开手机管理操作“垃圾文件清理”操作“内存清理” 然后&#xff0c;电源键功能恢复

魔趣9上手体验(坚果pro2)

一直喜欢原生的系统&#xff0c;但由于原生系统的功能简陋&#xff0c;一旦用到某些东西极为棘手。 我的坚果pro2厌倦了锤子风&#xff0c;决定改走一波原生路。 魔趣是基于安卓的二次开发&#xff0c;原生风味浓厚&#xff0c;类似于一加的氢OS。 魔趣9基于安卓9.0系统&…

坚果云和百度云哪个好?

事实上&#xff0c;对于这两个网盘&#xff0c;好与坏取决于如何理解网盘。 如果认为网盘就是一个网上的硬盘&#xff0c;其意义就在于扩展硬盘容量&#xff0c;把一些不常使用的数据放在云盘上&#xff0c;那百度网盘很适合你。 但是如果对于网盘的需求不单单是要保存数据&…