《学生考勤管理系统C》由会员分享,可在线阅读,更多相关《学生考勤管理系统C(15页珍藏版)》请在金锄头文库上搜索。
1、附录代码:#include iostream#include #include string.h#include using namespace std;#define Size 1000class Recordpublic: Record(); /构造函数 void Entersystem(); /进入系统函数 void GetPwd(); /获取密码 void SetDate(); /输入设立学生信息 void SetPwd(); /修改登录密码 void ReadDate(); /读取文本信息函数 void SaveData(); /向文本保存信息函数 void PutRecord();
2、 /输入考勤函数 void FindRecord(); /查找学生信息函数 void ShowRecord(); /输出所有学生信息 void Order(); /按学号排序 void ModifyDate(); /修改学生信息 void DelRecord(); /删除学生信息private: int renshu; /学生人数 int chidao; /迟到次数 int zaotui; /早退次数 int kuangke; /旷课次数 int qingjia; /请假次数long ID; /学生学号char Name20; /学生姓名char password20; /登录密码void S
3、howDate(int i);/类旳实现/构造函数Record:Record() renshu=0; chidao=0; zaotui=0; qingjia=0; kuangke=0; ID=0; Name20=0; password20=0;Record CRecordSize;char pwd=1,2,3,4,5,6;/输出函数void Record:ShowDate(int i) coutt CRecordi.ID CRecordi.Name CRecordi.chidao CRecordi.zaotui CRecordi.qingjia CRecordi.kuangkeendl;/获取
4、密码void Record:GetPwd() int a=0;while(1) char ch; ch=getch(); if(ch=b) if(a!=0) coutchar(b) char(b); a-; else if(ch=r) passworda=0; coutendl; break; else cout*; passworda+=ch; / /登陆进入系统void Record:Entersystem() int a=3,b=1; char repwd20; fstream file(mima.dat,ios:in|ios:binary);file.get(repwd,20,0);f
5、ile.close(); b=strlen(repwd);if(b) strcpy(pwd,repwd); while(a) system(cls); coutnnnnttt欢迎使用考勤管理系统!; coutnnntt请输入登陆密码:; GetPwd(); a-; if(strcmp(pwd,password)!=0) if(a) system(cls); coutnnntt密码输入错误!尚有a次输入机会!n; couttt; system(pause); else system(cls); coutnnntt持续3次密码输入错误!系统自动退出!n; couttt; system(pause)
6、; exit(0); else break;/修改密码void Record:SetPwd() char repwd20=0; int a=0; while(!a) system(cls);coutnnnntt输入原密码: ; GetPwd(); if(strcmp(password,pwd)!=0) coutnntt原密码错误!nn a; if(a) system(cls); coutnnnnttt密码修改失败!nn; else coutnntt请输入新密码:; GetPwd(); strcpy(repwd,password); coutnntt再次输入新密码:; GetPwd(); if(
7、strcmp(repwd,password)!=0) coutnntt两次输入密码不相似!nn a;if(a) system(cls); coutnnnnttt密码修改失败!nn; else strcpy(pwd,password); coutnntt密码修改成功!请牢记你旳新密码!nn; fstream file(mima.dat,ios:out|ios:binary); file.write(pwd,strlen(pwd); file.close(); break; /输入增添学生人数void Record:SetDate() int i=0; int m=0; coutm; for(i=0;im;i+) coutn输入/增添第i+1个学生旳信息 :endl; coutCRecordrenshu+i.ID;coutCRecordrenshu+i.Na