高校教师人事管理系统C语言设计源代码
C语言课程设计 职工信息管理系统 结构体数组实现程序源代码
//C语言课程设计职工信息管理系统—结构体数组实现#include <stdio.h>#include <stdlib.h>#include <string.h>struct employee{char num[10];char name[15];char sex[5];char bm[20];char zc[20];int gz;};int read_file(struct employee em[]);void menu();void write_file(struct employee em[]);void add();void select(); //查看职工所有信息void zc_query(); //按职称查询void num_del(); //按工号删除void tongji(); //统计void sort(); //排序void num_modify(); //按工号修改职工信息void save(); //保存信息void disp(); //显示职工信息void fh(); //返回主菜单struct employee em[300]; //这个数组用来保存所有的职工信息和文件里面的一致int Number=0; //记录总的职工人数也就是数组/文件里面的职工人数void menu(){printf("\t***********************************************************************\n");printf("\t* *\n");printf("\t* 职工信息管理系统_结构体数组实现*\n");printf("\t* *\n");printf("\t* [1] 增加职工信息 [2] 查看职工信息 *\n");printf("\t* [3] 查找职工信息 [4] 删除职工信息 *\n");printf("\t* [5] 统计 [6] 职工工资排列 *\n");printf("\t* [7] 修改职工信息 [8] 保存职工信息 *\n");printf("\t* [9] 显示职工信息 [0] 退出系统 *\n");printf("\t* *\n");printf("\t***********************************************************************\n");}void main(){int choose=0;FILE *fp=NULL;char yesorno;if((fp=fopen("employee1.txt","rb+"))==NULL){printf("\n=========>提示:文件不存在,是否要创建一个?(y/n)\n");scanf("%c",&yesorno);if(yesorno=='y'||yesorno=='Y'){//这里仅为了建立文件fp=fopen("employee1.txt","wb+");fclose(fp); //关闭fp所指的文件,释放文件缓冲区}elseexit(0);}else{Number=read_file(em); //要是文件已经有数据将数据初始化到数组中}system("cls");while(1){menu();printf("\t\t====>请选择:");scanf("%d",&choose);system("cls");switch(choose){case 0:exit(0); //退出break;case 1:add();fh();//增加职工信息 break;case 2:select();fh();//查看职工信息 break;case 3:zc_query();fh();// 查找break;case 4:num_del();fh();//删除break;case 5:tongji();fh();//统计break;case 6:sort();fh();//排序break;case 7:num_modify();fh();//修改后返回 break;case 8:save();fh();//保存break;case 9:disp();fh();break;//显示default:break;}fflush(stdin);getchar();system("cls");}}void save(){printf("\t=====程序在运行时已自动保存.....\n");}void fh(){printf("\t===>按Enter键返回主菜单\n");}void num_modify() //修改职工信息{FILE *fp=NULL;char gh[60];int i=0;int changeIndex=0; //changeIndex 改变标记int index=0;printf("请输入要修改的职工工号:");scanf("%s",gh);for (i=0;i<Number;i++){if (strcmp(gh,em[i].num)==0) //比较输入工号和数组中已有工号{changeIndex=i; //保存要修改的人的下标break;}}printf("\t工号\t姓名\t性别\t部门\t职称\t工资\n");printf("\t%s\t%s\t%s\t%s\t%s\t%d\n\n",em[changeIndex].num,em[chan geIndex].name,em[changeIndex].sex,em[changeIndex].bm,em[changeIndex]. zc,em[changeIndex].gz);printf("请重新输入该职工信息");printf("工号:");scanf("%s",em[changeIndex].num);printf("姓名:");scanf("%s",em[changeIndex].name);printf("性别:");scanf("%s",em[changeIndex].sex);printf("部门:");scanf("%d",em[changeIndex].bm);printf("职称:");scanf("%s",em[changeIndex].zc);printf("工资:");scanf("%d",&em[changeIndex].gz);//信息修改后重新更新文件里面的数据以保持数据一致性fp=fopen("employee1.txt","wb+");for (i=0;i<Number;i++){fwrite(&em[i],sizeof(struct employee),1,fp); //把ptr所指向n*size个字节输入到fp所指向的文件中}fclose(fp);printf("\t=======>修改成功\n");}void disp() //输出所有职工信息{int i=0;for (i=0;i<Number;i++){printf("\t%s\t%s\t%s\t%s\t%s\t%d\n\n",em[i].num,em[i].name,em[i]. sex,em[i].bm,em[i].zc,em[i].gz);}}void sort()//排序{struct employee t;int wantNUmber=0;int i=0;int j=0;int k=0;for(i=0;i<Number-1;i++){k=i;for(j=i+1;j<Number;j++){if(em[j].gz>em[k].gz)k=j;}if(k!=i){t=em[i];em[i]=em[k];em[k]=t;}}printf("你想输出前几名职工的信息:");scanf("%d",&wantNUmber);if (wantNUmber>Number){wantNUmber=Number;}printf("\t工号\t姓名\t性别\t部门\t职称\t工资\n");for(i=0;i<wantNUmber;i++){printf("\t%s\t%s\t%s\t%s\t%s\t%d\n\n",em[i].num,em[i].name,em[i].sex, em[i].bm,em[i].zc,em[i].gz);}}void tongji()//统计{int i,m,k,max,min;double sum=0.0;for(i=0;i<Number;i++){sum=sum+em[i].gz;}printf("全体职工的总工资为:%f\n",sum);printf("平均工资为:%f\n",sum/Number);i=0;m=0;max=0;max=em[m].gz;for(i=1;i<Number;i++){if (em[i].gz>max)m=i;max=em[m].gz;}printf("最高工资为:%d\n",max);printf("\t%s\t%s\t%s\t%s\t%s\t%d\n\n",em[m].num,em[m].name,em[m]. sex,em[m].bm,em[m].zc,em[m].gz);i=0;k=0;min=0;min=em[0].gz;for(i=1;i<Number;i++){if (em[i].gz<min)k=i;min=em[k].gz;}printf("最低工资:%d\n",min);printf("\t%s\t%s\t%s\t%s\t%s\t%d\n\n",em[k].num,em[k].name,em[k]. sex,em[k].bm,em[k].zc,em[k].gz);}void num_del()//按工号删除FILE *fp=NULL;char gh[60];int i=0;int j=0;printf("请输入要删除的职工工号:");scanf("%d",gh);for(i=0;i<Number;i++){if (strcmp(gh,em[i].num)==0) //如果查找到就删除{for (j=i;j<Number-1;j++){em[j]=em[j+1];}Number--;}}//将剩余数据写入文件重新一写的方式打开文件把以前的数据擦除了fp=fopen("employee1.dat","wb");for (i=0;i<Number;i++){fwrite(&em[i],sizeof(struct employee),1,fp);}fclose(fp);printf("删除成功;\n");}void zc_query()//按职称查找{char zc[20];int i=0;printf("请输入要查找职工职称:");scanf("%s",zc);system("cls");printf("\t工号\t姓名\t性别\t部门\t职称\t工资\n");for (i=0;i<Number;i++){if (strcmp(zc,em[i].zc)==0){printf("\t%s\t%s\t%s\t%s\t%s\t%d\n\n",em[i].num,em[i].name,em[i]. sex,em[i].bm,em[i].zc,em[i].gz);}}void select()//查看职工{int i=0;printf("以下是全部职工信息\n");printf("\t工号\t姓名\t性别\t部门\t职称\t工资\n");for(i=0;i<Number;i++){printf("\t%s\t%s\t%s\t%s\t%s\t%d\n\n",em[i].num,em[i].name,em[i]. sex,em[i].bm,em[i].zc,em[i].gz);}}void add()//增加职工{int numberTemp=0;int i=0;struct employee temp; //临时保存信息printf("请输入要增加职工信息的个数:");scanf("%d",&numberTemp);for(i=0;i<numberTemp;i++){printf("输入第%d个职工信息\n",i+1);printf("工号:");scanf("%s",temp.num);printf("姓名:");scanf("%s",);printf("性别:");scanf("%s",temp.sex);printf("部门:");scanf("%s",temp.bm);printf("职称:");scanf("%s",temp.zc);printf("工资:");scanf("%d",&temp.gz);em[Number++]=temp; //将刚添加的写入到数组write_file(&temp); //将刚添加的写入到文件}printf("添加成功\n");}void write_file(struct employee *em){FILE *fp=NULL;fp=fopen("employee1.txt","rb+");fwrite(em,sizeof(struct employee),1,fp);fclose(fp);}int read_file(struct employee em[]){FILE *fp=NULL;int i=0;fp=fopen("employee1.txt","rb");while(fread(&em[i],sizeof(struct employee),1,fp)) i++;fclose(fp);return i;}。
教师信息管理c语言程序设计
教师信息管理c语言程序设计教师信息管理是一件非常重要的事情,一个好的教师信息管理系统可以有效地帮助学校管理教师的信息,包括基本信息、工作情况、任职情况等等。
本篇文章将介绍如何用C 语言设计一个教师信息管理系统。
首先,我们需要定义一些数据结构来存储教师的信息。
这些数据结构可以包括结构体和数组。
例如,我们可以定义一个教师的结构体:typedef struct{char name[20]; //教师姓名char gender; //性别int age; //年龄char department[20]; //教师所在院系char position[20]; //职称int salary; //工资} Teacher;然后我们可以用一个数组来存储多个教师的信息:Teacher teachers[100];这样,我们就可以存储100个教师的信息了。
接下来,我们需要设计一些函数来实现教师信息的增加、删除、修改和查询。
这些函数可以包括:1. void add_teacher():用于添加教师信息。
void add_teacher(){Teacher teacher;printf("请输入教师姓名:");scanf("%s", );printf("请输入教师性别:");scanf(" %c", &teacher.gender);printf("请输入教师年龄:");scanf("%d", &teacher.age);printf("请输入教师所在院系:");scanf("%s", teacher.department);printf("请输入教师职称:");scanf("%s", teacher.position);printf("请输入教师工资:");scanf("%d", &teacher.salary);teachers[count++] = teacher; //将教师信息添加到数组中}至此,我们已经完成了一个基本的教师信息管理系统。
高校教师人事管理系统(c和链表)
高校教师人事管理系统(c和链表)#include "stdio.h"#include "stdlib.h"#include "string.h"#define FORMAT printf("编号姓名性别出生日期(格式:2010 08 01) 参加工作时间工资学院职称学位\n ");#define LEN sizeof(struct teacher)struct teacher *creat(void);void print(struct teacher *head);void save(struct teacher *head);struct teacher *read(void);struct teacher *add(void);struct teacher *array(struct teacher *head);struct teacher *del();struct teacher *modify();void find();void statistics();struct date{int year,month,day;};typedef struct teacher //编号、姓名、性别、出生日期、参加工作时间、工资、学院、职称(助教、讲师、副教授、教授)、学位(学士、硕士、博士){long number;int salary;char name[20], sex[10], date_time[20], college[20],title[20], degree[20] ;struct date birth;struct teacher *next;}TE;int n=0,m=0,n_1=0; //n:记录教师数目;m和n_1都是记录读取文件中的教师数目;TE * creat(void) //函数功能:创建teacher信息{TE *head=NULL, *p1=NULL, *p2=NULL;p1=p2=(TE *)malloc(LEN);printf("请输入教师信息:\n");FORMAT;scanf("%ld%s%s%d%d%d%s%d%s%s%s",&p1->number,p1->name, p1->sex, &p1->birth.year,&p1->birth.month,&p1->birth.day,&p1->date_time, &p1->salary, p1->college, p1->title, p1->degree);while(p1->number!=0){n+=1;if(n == 1) head=p1;else p2->next=p1;p2=p1;p1=(TE *)malloc(LEN);scanf("%ld%s%s%d%d%d%s%d%s%s%s",&p1->number,p1->name, p1->sex, &p1->birth.year,&p1->birth.month,&p1->birth.day,&p1->date_time, &p1->salary, p1->college, p1->title, p1->degree);//printf("OK!\n");}p2->next=NULL;free(p1);return(head);}void print(TE *head) //函数功能:输出信息{TE *p1=head;printf("共有教师 %d 名\n",m);FORMAT;if(head!=NULL)do{printf("%ld\t%s\t%s\t%d_%d_%d\t%s\t%d\t%s\t%s\t%s\n", p1->number, p1->name, p1->sex,p1->birth.year,p1->birth.month,p1->birth.day,&p1->date_time, &p1->salary, p1->college, p1->title, p1->degree);p1=p1->next;}while(p1!=NULL);}TE *del() //函数功能:删除信息{long can_num;TE *head,*p1,*p2;p1=p2=head=read();print(head);printf("请输入要删除的教师编号\n");scanf("%ld",&can_num);while(p1->number != can_num && p1->next !=NULL) { p2=p1; p1=p1->next; } //找出p1指向的节点if(p1->number == can_num){if(p1==head) head=p1->next;else p2->next=p1->next;printf("del: %ld\n",can_num);n--;printf("还有教师%d位\n",n);}else printf("没有你要查找的教师!\n");save(head);return(head);}void find() //函数功能:查找{int select;long find_num;charfind_name[20],find_time[20],find_college[20],find_title[20];TE *p1,*p2,*head;p1=p2=head=read();print(head);printf("按下列选项查询教师信息\n");printf("1.编号 2.姓名 3.参加工作时间 4.学院 5.职称 \n 请选择:");scanf("%d",&select);if(select==1){printf("请输入编号:");scanf("%ld",&find_num);while(p1->number != find_num && p1->next !=NULL){ p2=p1; p1=p1->next; }if(p1->number == find_num ){FORMAT;printf("%ld %s %s %d %d %d %s %d %s % s %s\n",p1->number, p1->name, p1->sex,p1->birth.year,p1->birth.month,p1->birth.day,&p1->date_time, &p1->salary, p1->college, p1->title, p1->degree);}else printf("没有要查找的教师信息!!\n");}if(select==2){printf("请输入姓名:");scanf("%s",find_name);while(strcmp(p1->name,find_name)!=0 && p1->next !=NULL ){ p2=p1; p1=p1->next; }if(strcmp(p1->name,find_name)==0){FORMAT;printf("%ld %s %s %d %d %d %s %d %s % s %s\n",p1->number, p1->name, p1->sex,p1->birth.year,p1->birth.month,p1->birth.day,&p1->date_time, &p1->salary, p1->college, p1->title, p1->degree);}else printf("没有要查找的教师信息!!\n");}if(select==3){int n_n=0;printf("请输入参加工作时间:");scanf("%s",find_time);while(p1 != NULL){if(strcmp(p1->date_time,find_time)==0){if(n_n ==0) FORMAT;printf("%ld %s %s %d %d %d %s %d %s % s %s\n",p1->number, p1->name, p1->sex,p1->birth.year,p1->birth.month,p1->birth.day,&p1->date_time, &p1->salary, p1->college, p1->title, p1->degree);n_n++;}p1=p1->next;}if(n_n == 0) printf("没有要查找的教师信息!!\n");}if(select==4){int n_n=0;printf("学院:");scanf("%s",find_college);while(p1 != NULL ){if(strcmp(p1->college,find_college)==0 ){if(n_n ==0) FORMAT;printf("%ld %s %s %d %d %d %s %d %s % s %s\n",p1->number, p1->name, p1->sex,p1->birth.year,p1->birth.month,p1->birth.day,&p1->date_time, &p1->salary, p1->college, p1->title, p1->degree);n_n++;}p2=p1; p1=p1->next;}if(n_n == 0) printf("没有要查找的教师信息!!\n");}if(select==5){int n_n=0;printf("职称:");scanf("%s",find_title);while(p1!=NULL ){if(strcmp(p1->title,find_title) ==0 ){if(n_n ==0) FORMAT;printf("%ld %s %s %d %d %d %s %d %s % s %s\n",p1->number, p1->name, p1->sex,p1->birth.year,p1->birth.month,p1->birth.day,&p1->date_time, &p1->salary, p1->college, p1->title, p1->degree);n_n++;}p2=p1; p1=p1->next;}if(n_n == 0) printf("没有要查找的教师信息!!\n");}}void statistics() //函数功能:统计{int birth_num=0,sum=0,title_num[4]={0},de_num[3]={0};float proport=0;TE *head,*p1,*p2;p1=head=read();print(p1);while(p1 != NULL){if(p1->birth.year >= 1980) birth_num++;p2=p1; p1=p1->next; sum++;}proport=(float)birth_num*100/sum;printf("\n1980后教师共有 %d 位,80后教师占教师总数的比率是:%4.2f \n",birth_num,proport);sum=0;p1=head;while(p1 != NULL){if(strcmp(p1->title,"助教")==0) title_num[0]++;if(strcmp(p1->title,"讲师")==0) title_num[1]++;if(strcmp(p1->title,"副教授")==0) title_num[2]++;if(strcmp(p1->title,"教授")==0) title_num[3]++;p2=p1; p1=p1->next; sum++;}for(int i=0; i<4 ;i++) sum+=title_num[i] ;proport=(float)(title_num[2]+title_num[3])/sum;printf("\n助教%d位、讲师%d位、副教授%d位、教授%d位。
c语言设计的人事管理系统源码
#include<iostream.h>#include<string.h>#include<iomanip.h>#include<fstream.h>#include<stdio.h>#include<stdlib.h>#include<conio.h>int k=1,i; //定义一个标志变量class birthday{ //定义出生年月日类public:int year;int month;int day;};class people{ //声明人员基类,以后在这个基础上派生出其它类public:people(){}virtual void enter(); //虚基函数,搭成一个框架,以后在此基础上扩充virtual void display();virtual int get_no(){return number;}virtual char * get_name(){return name;}virtual void change_infor(){} //信息修改函数virtual void readfile(){} //从文件中读virtual void write(){} //将信息写入文件people operator = (people p1); //运算符重载int operator == (people p1);virtual ~people(){};protected:char name[12];int number;char sex;birthday bir;char id[15];};people people::operator =(people p1)//定义运算符重载{strcpy(name,); number=p1.number; sex=p1.sex; bir.day=p1.bir.day;bir.month=p1.bir.month; bir.year=p1.bir.year;strcpy(id,p1.id);return p1;}int people::operator ==(people p1){if(id==p1.id) return 1;else return 0;}void people::enter(){ //定义信息输入函数cout<<"输入姓名:"; cin>>name;cout<<"输入编号:"; cin>>number;cout<<"输入性别:"; cin>>sex;cout<<"生日是(年月日):"; cin>>bir.year>>bir.month>>bir.day;cout<<"身份证号:";cin>>id;}void people::display(){ //定义信息显示函数cout<<setw(8)<<"姓名"<<setw(8)<<"编号"<<setw(8)<<"性别"<<setw(8)<<"出生日期"<<setw(8)<<"身份证号"<<endl;cout<<setw(8)<<name<<setw(8)<<number<<setw(8)<<sex<<setw(8)<<bir.year<<setw(8)<<bir.mo nth<<setw(8)<<bir.day<<setw(8)<<id<<endl;}class student:virtual public people{ //以公有方式派生出学生类protected:char classnumber[20];public:student(){}virtual void enter(){people::enter();cout<<"输入班级名称:";cin>>classnumber;}virtual void display();virtual void readfile();virtual void write();virtual void change_infor();virtual ~student(){};};class teacher:virtual public people{ //以公有方式派生出老师类protected:char principalship[16];char department[16];public:teacher(){}virtual void enter(){people::enter();cout<<"输入老师的职务:";cin>>principalship;cout<<"\n 输入老师所在的部门:";cin>>department;}virtual void display();virtual void readfile();virtual void write();virtual void change_infor();virtual ~teacher(){}};//class graduate:virtual public student{ //以公有方式派生出研究生类protected:char subject[16];teacher adviser;public:graduate(){};virtual void enter(){student::enter();cout<<"输入研究生的专业:";cin>>subject;cout<<"输入导师的情况:"<<endl;adviser.enter();}virtual void display();virtual void readfile();virtual void write();virtual void change_infor();virtual ~graduate(){};};class teacher_asistant:public teacher,public graduate{ //以公有方式派生出助教类public:teacher_asistant(){};virtual void enter(){graduate::enter();cout<<"请输入助教生所在职务:";cin>>principalship;cout<<"请输入所在部门:";cin>>department;}virtual void display();virtual void readfile();virtual void write();virtual void change_infor();virtual ~teacher_asistant(){}};void student::display(){ //定义派生类学生的信息显示函数cout<<setw(8)<<"姓名"<<setw(8)<<"编号"<<setw(5)<<"性别"<<setw(12)<<"出生日期"<<setw(12)<<"身份证号"<<setw(12)<<"班级名称"<<endl;cout<<setw(8)<<name<<setw(8)<<number<<setw(5)<<sex<<setw(4)<<bir.year<<setw(4)<<bir.mo nth<<setw(4)<<bir.day<<setw(10)<<id<<setw(12)<<classnumber<<endl;}void student::write(){ //定义派生类学生的信息写入文件函数student stu;char ch;ofstream myfile("student.txt",ios::app);do{stu.enter();myfile.write((char *)&stu,sizeof(stu));cout<<"还需要输入下个学生的信息吗(y/n):";cin>>ch;}while(ch=='y'||ch=='Y');myfile.close();}void student::readfile(){ //定义派生类学生的读文件函数ifstream myfile("student.txt",ios::nocreate);while(myfile){student stu;if(myfile.read((char*)&stu,sizeof(stu))){if(stu.number!=-1) //删除一个学生的信息,通过不显示来定义删除stu.display();}}myfile.close();}void student::change_infor(){ //定义派生类学生的信息修改函数student stu;int num,p;cout<<"请输入你要修改或者删除的学生的编号:";cin>>num;fstream myfile("student.txt",ios::in|ios::out);while(myfile.good()){myfile.read((char*)&stu,sizeof(stu));if(num==stu.number){myfile.seekg(-sizeof(stu),ios::cur);cout<<"你是要修改还是要删除该学生的记录(1:删除2:修改):";cin>>p;if(p==1){stu.number=-1;break;}else {cout<<"请输入新的信息"<<endl;stu.enter();break;}}}myfile.write((char *)&stu,sizeof(stu));myfile.close();}void teacher::display(){cout<<setw(8)<<"姓名"<<setw(8)<<"编号"<<setw(5)<<"性别"<<setw(12)<<"出生日期"<<setw(12)<<"身份证号"<<setw(10)<<"职务"<<setw(10)<<"部门"<<endl;cout<<setw(8)<<name<<setw(8)<<number<<setw(5)<<sex<<setw(4)<<bir.year<<setw(4)<<bir.mo nth<<setw(4)<<bir.day<<setw(12)<<id<<setw(10)<<principalship<<setw(10)<<department<<endl ;}void teacher::readfile(){ifstream myfile("teacher.txt",ios::nocreate);while(myfile){people *p;teacher tec;p=&tec;if(myfile.read((char*)&tec,sizeof(tec))){if(tec.number!=-1)p->display();}}myfile.close();}//void teacher::write(){teacher tec;char ch;ofstream myfile("teacher.txt",ios::app);do{tec.enter();myfile.write((char *)&tec,sizeof(tec));cout<<"还需要输入下个学生的信息吗(y/n):";cin>>ch;}while(ch=='y'||ch=='Y');myfile.close();}void teacher::change_infor(){teacher tec;int num,p;cout<<"请输入你要修改或者删除的老师的编号:";cin>>num;fstream myfile("teacher.txt",ios::in|ios::out);while(myfile.good()){myfile.read((char*)&tec,sizeof(tec));if(num==tec.number){myfile.seekg(-sizeof(tec),ios::cur);cout<<"你是要修改还是要删除该老师的记录(1:删除2:修改):";cin>>p;if(p==1){tec.number=-1;break;}else {cout<<"请输入新的信息"<<endl;tec.enter();break;}}}myfile.write((char *)&tec,sizeof(tec));myfile.close();}void graduate::display(){cout<<setw(8)<<"姓名"<<setw(8)<<"编号"<<setw(5)<<"性别"<<setw(12)<<"出生日期"<<setw(8)<<"身份证号"<<setw(8)<<"班级名称"<<setw(10)<<"专业"<<endl;cout<<setw(8)<<name<<setw(8)<<number<<setw(5)<<sex<<setw(4)<<bir.year<<setw(4)<<bir.mo nth<<setw(4)<<bir.day<<setw(8)<<id<<setw(8)<<classnumber<<setw(10)<<subject<<endl;cout<<"他的导师的情况是:"<<endl;adviser.display();}void graduate::readfile(){ifstream myfile("graduate.txt",ios::nocreate);while(myfile){people *p;graduate gra;p=&gra;if(myfile.read((char*)&gra,sizeof(gra))){if(gra.number!=-1)p->display();}}myfile.close();}void graduate::write(){graduate gra;char ch;ofstream myfile("graduate.txt",ios::app);do{gra.enter();myfile.write((char *)&gra,sizeof(gra));cout<<"还需要输入下个研究生的信息吗(y/n):";cin>>ch;}while(ch=='y'||ch=='Y');myfile.close();}void graduate::change_infor(){graduate gra;int num,p;cout<<"请输入你要修改或者删除的研究生的编号:";cin>>num;fstream myfile("graduate.txt",ios::in|ios::out);while(myfile.good()){myfile.read((char*)&gra,sizeof(gra));if(num==gra.number){myfile.seekg(-sizeof(gra),ios::cur);cout<<"你是要修改还是要删除该研究生的记录(1:删除2:修改):";cin>>p;if(p==1){gra.number=-1;break;}else {cout<<"请输入新的信息"<<endl;gra.enter();break;}}}myfile.write((char *)&gra,sizeof(gra));myfile.close();}void teacher_asistant::display(){cout<<setw(8)<<"姓名"<<setw(8)<<"编号"<<setw(5)<<"性别"<<setw(12)<<"出生日期"<<setw(12)<<"身份证号"<<setw(8)<<"班级名称"<<setw(10)<<"专业"<<setw(10)<<"职务"<<setw(10)<<"部门"<<endl;cout<<setw(8)<<name<<setw(8)<<number<<setw(5)<<sex<<setw(4)<<bir.year<<setw(4)<<bir.mo nth<<setw(4)<<bir.day<<setw(8)<<id<<setw(8)<<classnumber<<setw(10)<<subject<<setw(10)<< principalship<<setw(10)<<department<<endl;cout<<"他的导师的情况是:"<<endl;adviser.display();}void teacher_asistant::readfile(){ifstream myfile("tec_asistant.txt",ios::nocreate);while(myfile){people *p;teacher_asistant tec_asis;p=&tec_asis;if(myfile.read((char*)&tec_asis,sizeof(tec_asis))){if(tec_asis.number!=-1)p->display();}}myfile.close();}void teacher_asistant::write(){teacher_asistant tec_asis;char ch;ofstream myfile("tec_asistant.txt",ios::app);do{tec_asis.enter();myfile.write((char *)&tec_asis,sizeof(tec_asis));cout<<"还需要输入下个助教生的信息吗(y/n):";cin>>ch;}while(ch=='y'||ch=='Y');myfile.close();}//void teacher_asistant::change_infor(){teacher_asistant tec_asis;int num,p;cout<<"请输入你要修改或者删除的助教生的编号:";cin>>num;fstream myfile("tec_asistant.txt",ios::in|ios::out);while(myfile.good()){myfile.read((char*)&tec_asis,sizeof(tec_asis));if(num==tec_asis.number){myfile.seekg(-sizeof(tec_asis),ios::cur);cout<<"你是要修改还是要删除该助教生的记录(1:删除2:修改):";cin>>p;if(p==1){tec_asis.number=-1;break;}else {cout<<"请输入新的信息"<<endl;tec_asis.enter();break;}}}myfile.write((char *)&tec_asis,sizeof(tec_asis));myfile.close();}void menu(){cout<<"\n\n\t\t**************************************************"<<endl;cout<<"\t\t*\t 人事管理系统\t *"<<endl;cout<<"\t\t*------------------------------------------------*"<<endl;cout<<" \t\t* 1.请输入人事信息 2.显示人事信息*"<<endl;cout<<" \t\t* 3.对信息的修改或删除 4.返回主菜单0.退出*"<<endl;cout<<"\t\t**************************************************"<<endl;cout<<" \t\t\t\t请选择操作(0=======4) "<<endl;cout<<"\t\t\t\t 请选择:";}void select(){people *pt;student st; teacher te; graduate gr; teacher_asistant t_a;if(i==1) pt=&st;else if(i==2) pt=&gr;else if(i==3) pt=&te;else if(i==4) pt=&t_a;do{int ch;cin>>ch;switch(ch){case 0:exit(0);case 1:pt->write();cout<<"你还想进行何种操作:";break;case 2:pt->readfile();cout<<"你还想进行何种操作:";break;case 3:pt->change_infor();cout<<"你还想进行何种操作:";break;case 4:k=0;break;default:cout<<"你的选择错误,请重新选择:";break;}}while(k);}void main(){b:cout<<"\n\n\t\t***************************************************"<<endl;cout<<"\t\t*\t 人事管理系统\t *"<<endl;cout<<"\t\t*-----------------------------------------------------*"<<endl;cout<<"\t\t* 1:学生*"<<endl;cout<<"\t\t* 2:研究生*"<<endl;cout<<"\t\t* 3:教师*"<<endl;cout<<"\t\t* 4:助教*"<<endl;cout<<"\t\t* 0:退出*"<<endl;cout<<"***************************************************"<<endl;cout<<"请选择(0---4):";cin>>i;switch(i){case 0:cout<<"你已经退出系统";getch();exit(0);case 1:{system("cls");menu();select();break;}case 2:{system("cls");menu();select();break;}case 3:{system("cls");menu();select();break;}case 4:{system("cls");menu();select();break;}default :cout<<"你的选择有误,请重新选择:";break;}if(k==0)k=1;system("cls");goto b;}。
C语言人事管理系统设计
设计题目:人事管理系统设计目录:1.设计任务---------------------------------------------------------------------------------------------12.正文-----------------------------------------------------------------------------------------------------------2(1).系统模块图------------------------------------------------------------------------------------------3 (2).模块说明---------------------------------------------------------------------------------------------3 (3).用户使用说明---------------------------------------------------------------------------------------3 (4).测试结果---------------------------------------------------------------------------------------------33.设计小结--------------------------------------------------------------------------------------------------94.附录-----------------------------------------------------------------------------------------------------------10一.设计任务1、需求分析:人事档案信息采用文件存储,因而要提供文件的输入输出操作;根据学院人事的变动情况,添加删除记录,因而要提供文件的添加删除操作;根据编号和姓名进项查询,所以要提供文件的查找操作;高级编辑功能,就是提供文件的修改操作;统计功能要提供统计操作;排序功能要提供用排序算法对文件记录的排序;另外还要提供键盘式选择菜单以实现功能选择。
高校人事管理系统
高校人事管理系统5、1源程序#include <fstream.h>//全局变量(代码表)char *Type[]={"行政人员","教师","一般员工","退休人员","返聘人员","临时工"}; char *Sex[]={"男","女"};char *Pos[]={"无","科级","处级","地级"};char *TechPos[]={"无","初级","中级","高级"};char *Party[]={"群众","中共党员","民主党派"};char *Study[]={"小学","初中","高中","大专","大学","硕士","博士"};class Date //日期类{private:int y,m,d;public:friend ostream& operator<<(ostream& os,Date& day);friend istream& operator>>(istream& is,Date& day);};ostream& operator<<(ostream& os,Date& day){os<<day.y<<"/"<<day.m<<"/"<<day.d;return os;}istream& operator>>(istream& is,Date& day){is>>day.y>>day.m>>day.d;return is;}class Person //人员类{private:int No; //编号int Type; //职工分类char Name[20];//姓名int Sex; //性别int Age; //年龄Date D1; //参加工作时间Date D2; //来院时间int Pos; //职务int TechPos; //职称int Party; //政治面貌int Study; //学历Person *next;public:Person(){next=0;}void Print(); //输出1个职工信息friend istream& operator>>(istream& is,Person &p); //重载">>",人员信息输入. friend class College;};void Person::Print(){cout<<No<<","<<::Type[Type]<<","<<Name<<","<<::Sex[Sex]<<","<<Age<<","<<D1<<","<<D2<<","<<::Pos[Pos]<<","<<::TechPos[TechPos]<<","<<::Party[Party]<<","<<::Study[Study]<<endl;}istream& operator>>(istream& is,Person &p){cout<<"编号:"; cin>>p.No;cout<<"职工分类[0-行政人员,1-教师,2-一般员工,3-退休人员,4-返聘人员,5-临时工]:"; cin>>p.Type;cout<<"姓名:"; cin>>;cout<<"性别[0-男,1-女]:"; cin>>p.Sex;cout<<"年龄:"; cin>>p.Age;cout<<"参加工作时间:"; cin>>p.D1;cout<<"来院时间:"; cin>>p.D2;cout<<"职务[0-无,1-科级,2-处级,3-地级]:";cin>>p.Pos;cout<<"职称[0-无,1-初级,2-中级,3-高级]:";cin>>p.TechPos;cout<<"政治面貌[0-群众,1-中共党员,2-民主党派]:"; cin>>p.Party;cout<<"学历[0-小学,1-初中,2-高中,3-大专,4-大学,5-硕士,6-博士]:";cin>>p.Study;return is;}class College //大学类{private:Person *PL; //职工链表void Clear(); //清除所有的职工结点(仅保留头结点) int Find(int ID,Person **p1,Person **p2); //查找职工结点public:College(); //构造~College(); //析构void Add(); //增加职工void Delete(); //删除职工void Modify(); //修改职工void Print(); //输出职工信息void Stat(); //综合统计void Save(); //职工信息存盘void Load(); //职工信息装入};College::College() //构造函数(创建1个头结点的链表) {Person *p=new Person;p->next=0;PL=p;cout<<"自动装入数据...\n";Load();}College::~College() //析构函数(仅保留1个头结点){Person *p=PL;while(p) //逐个删除结点,包括头结点{PL=p->next;delete p;p=PL;}PL=0;}void College::Add() //增加职工{cout<<"\n** 增加职工**\n";//创建新结点Person *pa=new Person;cin>>*pa;pa->next=0;//查找尾结点Person *p=PL;while(p->next)p=p->next;//连接p->next=pa;}void College::Clear() //清除所有的职工结点(仅保留头结点){Person *p=PL->next;while(p){PL->next=p->next;delete p;p=PL->next;}}//查找职工结点(返回1-找到,0-未找到.结点指针由p1返回,p2为前看指针) int College::Find(int ID,Person **p1,Person **p2){*p1=PL->next;*p2=PL;while(*p1){if((*p1)->No==ID)break; //找到else{*p2=*p1; //继续查找*p1=(*p1)->next;}}return *p1?1:0;}void College::Delete() //删除职工{cout<<"\n** 删除职工**\n";int No;Person *p1,*p2;cout<<"编号:"; cin>>No;if(!Find(No,&p1,&p2)){cout<<"指定的人员没有找到!\n";}else{p2->next=p1->next; //连接delete p1;cout<<"正确删除!\n";}}void College::Modify() //修改职工{cout<<"\n** 修改职工**\n";int No;Person *p1,*p2;cout<<"编号:"; cin>>No;if(!Find(No,&p1,&p2)){cout<<"指定的人员没有找到!\n";}else{p1->Print(); //输出原来的职工信息(做提示)cin>>*p1; //输入新的职工信息(更新)cout<<"修改完成!\n";}}void College::Print() //输出职工信息{cout<<"\n** 职工信息表**\n";cout<<"编号职工分类姓名性别年龄参加工作时间来院时间职务职称政治面貌学历\n";Person *p=PL->next;if(!p){cout<<"无职工记录!\n";return;}while(p) //遍历链表,输出职工信息{p->Print();p=p->next;}}void College::Stat() //综合统计{cout<<"\n** 综合统计**\n";int n1,n2,n3,n4;//n1-在职,n2-党员,n3-女工,n4-高职称或高学历(博士) n1=n2=n3=n4=0;Person *p=PL->next;while(p){if(p->Type!=3&&p->Type!=4&&p->Type!=5)n1++; //在职计数if(p->Party==1)n2++; //党员计数if(p->Sex==1)n3++; //女教工计数if(p->Study==6||p->TechPos==3)n4++; //高级职称/高学历计数p=p->next;}//统计数据输出cout<<"在职人员人数:"<<n1<<endl;cout<<"中共党员人数:"<<n2<<endl;cout<<"女工人数:"<<n3<<endl;cout<<"高学历/高职称人数:"<<n4<<endl;}void College::Save() //职工信息存盘{ofstream f("Person.dat",ios::out|ios::binary); //打开文件//遍历输出至文件Person *p=PL->next;while(p){f.write((char *)p,sizeof(Person));p=p->next;}f.close(); //关闭文件cout<<"职工信息已经保存在Person.dat.\n";}void College::Load() //职工信息装入{//清除现有结点(保留头结点)Clear();//打开文件ifstream f("Person.dat",ios::in|ios::binary);//建立结点,读数据Person *p=PL; //尾结点指针while(1){Person *pa=new Person; //建立新结点f.read((char *)pa,sizeof(Person)); //读入数据if(f){p->next=pa; //连接新结点p=pa; //更新尾结点指针}else{delete pa;break;}}//关闭文件f.close();}void main(){char ch;College c; //定义大学对象//显示主菜单,接受选择,并分支调用大学类的相应功能的成员函数do{cout<<"\n☆☆高校人事管理系统☆☆\n";cout<<"1-增加职工\n";cout<<"2-删除职工\n";cout<<"3-修改职工\n";cout<<"4-输出职工信息\n";cout<<"5-综合统计\n";cout<<"6-数据存盘\n";cout<<"7-数据装入\n";cout<<"8-退出\t请选择(1-8):";cin>>ch;switch(ch){case '1': c.Add(); break;case '2': c.Delete();break;case '3': c.Modify();break;case '4': c.Print(); break;case '5': c.Stat(); break;case '6': c.Save(); break;case '7': c.Load(); break;}}while(ch!='8');}5、2数据文件Person.dat:(Person类数据作为记录的二进制格式文件)class Person //人员类{private:int No; //编号int Type; //职工分类char Name[20];//姓名int Sex; //性别int Age; //年龄Date D1; //参加工作时间Date D2; //来院时间int Pos; //职务int TechPos; //职称int Party; //政治面貌int Study; //学历Person *next;public:Person(){next=0;}void Print(); //输出1个职工信息friend istream& operator>>(istream& is,Person &p); //重载">>",人员信息输入. friend class College;};5、3运行结果参考自动装入数据...☆☆高校人事管理系统☆☆1-增加职工2-删除职工3-修改职工4-输出职工信息5-综合统计6-数据存盘7-数据装入8-退出请选择(1-8):4** 职工信息表**编号职工分类姓名性别年龄参加工作时间来院时间职务职称政治面貌学历1,教师,wu,男,36,1993/5/1,2003/3/1,无,高级,群众,硕士2,教师,liu,男,22,2003/7/1,2003/7/1,无,无,群众,大学3,行政人员,tao,男,40,1984/7/1,1998/7/1,科级,高级,中共党员,大学4,教师,luo,男,25,1993/7/1,1993/7/1,无,初级,群众,硕士5,教师,he,女,22,2003/7/1,2003/7/1,无,无,群众,大学6,返聘人员,lin,男,65,1958/7/1,1958/7/1,处级,高级,中共党员,大学7,教师,zhao,女,22,2003/7/1,2003/7/1,无,无,群众,大学8,教师,quan,女,30,1998/7/1,1998/7/1,地级,中级,群众,大学☆☆高校人事管理系统☆☆1-增加职工2-删除职工3-修改职工4-输出职工信息5-综合统计6-数据存盘7-数据装入8-退出请选择(1-8):5** 综合统计**在职人员人数:7中共党员人数:2女工人数:3高学历/高职称人数:3☆☆高校人事管理系统☆☆1-增加职工2-删除职工3-修改职工4-输出职工信息5-综合统计6-数据存盘7-数据装入8-退出请选择(1-8):8 Press any key to continue。
教师管理系统源代码
}
fflush(stdin);
/*子函数退出后再次显示主界面*/
system("cls");
printf("****************************\n");lush(stdin);
gets(node->unit);
printf("基本工资:");
fflush(stdin);
scanf("%f",&salary);
node->salary=salary;
printf("津贴:");
scanf("%f",&allowance);
node->allowance=allowance;
s->total=total;
}
voiddel(char *s)
{
TEACHER *nod=head;
while(nod->next !=NULL)
{
if((!strcmp(nod->next->name,s))||(!strcmp(nod->next->unit,s))){
nod->next=nod->next->next;
printf("输入c退出,其他字符继续\n");
if((command=getchar())=='c')
break;
}
return 0;
}
int save()
C 课设高校人员信息管理系统附全部代码
《基于C++的面向对象程序设计实例》课程设计报告报告题目:高校人员信息管理系统作者所在系部:计算机科学与工程系作者所在专业:计算机科学与技术作者所在班级:作者姓名:指导教师姓名:完成时间:2010年6月《基于C++的面向对象程序设计实例》任务书一.目的与要求1、目的(1)要求学生能够熟练掌握C++语言的基本知识和技能。
(2)基本掌握面向对象程序设计的基本思路和方法。
(3)能够利用所学的基本知识和技能,解决简单的面向对象程序设计问题。
2、基本要求(1)要求利用面向对象的方法以及C++的编程思想来完成系统的设计。
(2)在系统的设计中,要求运用面向对象的机制(继承、派生及多态性)来实现系统功能,并且要建立清晰的类层次关系。
(3)在系统设计中要分析和定义各个类,每个类中要有各自的数据成员和成员函数。
(4)主函数中提供菜单选项,并给出足够的选择信息以及提示信息。
(5)程序具有一定的健壮性,不会因为用户的输入错误引起程序运行错误而中断执行。
对输入值的类型、大小范围、字符串的长度等,进行正确性检查,对不合法的输入值给出出错信息,指出错误类型,等待重新输入。
3、创新要求在基本要求达到后,可根据实际情况进行创新设计,如根据查找结果进行修改的功能及设计出比较友好的界面等。
二.验收方式完成设计内容之后,即可开始验收。
验收时,首先由学生简要说明所做题目的思路、设计结构及实现过程,然后运行程序并进行测试,对输出结果作出解释,同时认真回答教师提出的问题。
三.课设报告在完成验收之后,提交课设报告。
其中报告中需包括系统设计要求,设计思路,系统功能模块图,系统流程图,类的层次图(包括类成员列表),调试过程,关键程序代码,总结,参考书目等。
另外,课设报告要严格遵守模板文件的格式要求,思路清晰,内容详实丰富。
四.成绩评定课设总成绩=验收成绩(50%)+课程设计报告成绩(30%)+程序源代码(10%)+课设态度、考勤与遵守教学制度情况(10%)五.说明1、每位同学在以下的题目中任选一个来完成。
高校人事管理系统课程设计C++版
一.需求分析1.目的与意义、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、2.系统流程图二.总体设计1.系统功能分析执行程序后,按界面的显示,选择1—8种操作。
选1,增加人员资料,资料包括编号、职工类别、姓名、性别、年龄、来院时间、职务、职称、党派、学历。
选2,删除人员信息。
选3,修改人员信息,可以选择要修改的内容。
选4,查询人员信息,可按编号或姓名查询。
选5,数据存盘。
选6,数据装入。
选7,显示所有信息。
选8,退出。
2.系统功能模块划分与设计三.详细设计1.源程序代码#include<>#include<>#include<>#include<>class person{private:int no;...\n";}void save()面设计cout<<"**"<<endl;cout<<" 高校人事管理系统"<<endl;cout<<" "<<endl;cout<<" 1---增加人员资料"<<endl;cout<<" 2---删除人员信息"<<endl;cout<<" 3---修改人员信息"<<endl;cout<<" 4---查询人员信息"<<endl;cout<<" 5---数据存盘"<<endl;cout<<" 6---数据装入"<<endl;cout<<" 7---显示所有信息"<<endl;cout<<" 8---退出(1-8):"<<endl;cout<<"**"<<endl;cout<<"**"<<endl;2.各功能模块实现添加功能void add()编号查询bool find1(){int id;person *ahead=myfirst;person *follow=ahead;cout<<"请输入编号:"<<endl;cin>>id;cout<<"****"<<endl;if(ahead==NULL){cout<<"无人员信息!"<<endl;return false;}else{while(ahead!=NULL){if(ahead->getnum()==id){printf1(ahead);return true;}else{follow=ahead;ahead=ahead->getnext();}}cout<<"无此人信息:"<<endl;return false;}}2.按姓名查询bool find2( ){char nm[20];person *ahead=myfirst;person *follow=ahead;cout<<"输入姓名";cin>>nm;cout<<"****"<<endl;if(ahead==NULL){cout<<"无人员信息"<<endl;return false;}else{while(ahead!=NULL){if(strcmp(ahead->getname(),nm)==0){printf1(ahead);return true;}else{follow=ahead;ahead=ahead->getnext();}}cout<<"查无此人:"<<endl;return false;}}数据存盘功能void save(){ofstream fperson;("",ios::out);person *p=myfirst;while(p){fperson<<p->getnum()<<"\t"<<p->gettype()<<"\t"<<p->getname()<<"\t"<<p->ge tsex()<<"\t"<<p->getage()<<"\t"<<p->gettime()<<"\t"<<p->getpos()<<"\t"<<p->gettec hpos()<<"\t"<<p->getparty()<<"\t"<<p->getstudy();fperson<<endl;p=p->getnext();}();cout<<"保存数据已经完成"<<endl;}数据装入功能void load(){int nnum,nage;charntype[20],nname[20],nsex[20],ntime[20],npos[20],ntechpos[20],nparty[20],nstudy[2 0];ifstream fperson;("",ios::in);while()){fperson>>nnum>>ntype>>nname>>nsex>>nage>>ntime>>npos>>ntechpos>>np arty>>nstudy;insertatlast(nnum,ntype,nname,nsex,nage,ntime,npos,ntechpos,nparty,nstudy);}();cout<<"\n人员和相关数据已经装入.....\n";}显示功能void printf(){person *ahead=myfirst;cout<<"编号---姓名---性别---年龄---职工类型---职务---职称---学历---政治面貌---来院时间\n"<<endl;while(ahead!=NULL){ cout<<setiosflags(ios::left)<<setw(4)<<ahead->getnum()<<setiosflags(ios::left)<<set w(6)<<ahead->getname() ;cout<<setiosflags(ios::left)<<setw(5)<<ahead->getsex()<<setiosflags(ios::left)<<setw( 4)<<ahead->getage() ;cout<<setiosflags(ios::left)<<setw(10)<<ahead->gettype()<<seti osflags(ios::left)<<setw(6)<<ahead->getpos() ;cout<<setiosflags(ios::left)<<setw(6)<<ahead->gettechpos()<<setiosflags(ios::left)<<s etw(6)<<ahead->getstudy();cout<<setiosflags(ios::left)<<setw(9)<<ahead->getparty()<<setiosflags(ios::left)<<set w(12)<<ahead->gettime()<<endl;ahead=ahead->getnext();}}五.系统调试1.没有调用#include<>导致strcpy()操作不合法。
C语言教师管理系统代码
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <conio.h>/*函数声明*/void input(); // 此函数功能是输入教师信息int menu();//此函数是一个菜单//学号:struct data{int year;int month;int day;};struct teacher{char num[15];char name[30];struct data bir;char sex;float jbgz;float jt;};int menu(){int n;printf("1. 实现教师信息的录入\n");printf("2. 求每个教师的总工资,并输出\n");printf("3. 按总工资从高到低排序,输出教师信息\n");printf("4. 查找指定姓名的教师信息,假设不存在,给出提示信息\n");printf("5. 查找根本工资最高的教师信息\n");printf("6. 修改指定职工号的职工信息\n");printf("7. 程序结束\n");printf("************************************************\n");printf("请输入你要执行的操作:\n");scanf("%d",&n);while( n<1 || n>7){printf("请重新输入\n");scanf("%d",&n);}return n;}//实现教师信息录入void input(struct teacher a[],int n){int i;printf("石家庄经济学院\n");for(i=0;i<n;i++){printf("请输入教师工作号:");scanf("%s",a[i].num);printf("请输入教师姓名:");scanf("%s",a[i].name);printf("请输入教师出生日期:");scanf("%d%d%d",&a[i].bir.year,&a[i].bir.month,&a[i].bir.day);printf("请输入教师性别:");getchar();scanf("%c",&a[i].sex);printf("请输入教师根本工资:");scanf("%f",&a[i].jbgz);printf("请输入教师津贴:");scanf("%f",&a[i].jt);}}//实现教师信息输出void output(struct teacher a[],int n){int i;printf("工作号,姓名,出生日期,性别,根本工资,津贴,总工资:\n");for(i=0;i<n;i++)printf("%s %s %d %d %d %c %f %f %f\n",a[i].num,a[i].name,a[i].bir.year,a[i].bir.month,a[i].bir .day,a[i].sex,a[i].jbgz,a[i].jt,a[i].jbgz+a[i].jt);}//按工资从高到低排序,输出教师信息void sortbyzgz (struct teacher a[],int n){int i,j,k;struct teacher temp;for(i=0;i<n-1;i++){k=i;for(j=i+1;j<n;j++)if((a[j].jbgz+a[j].jt)>(a[i].jbgz+a[i].jt))k=j;if(k!=i){temp=a[i];a[i]=a[k];a[k]=temp;}}output(a,n);}//查找指定姓名的教师信息,假设不存在,给出提示信息void searchbyname(struct teacher a[],int n){char name[20];int flag=0;int i;printf("请输入要查找的教师姓名:\n");getchar();gets(name);for(i=0;i<n;i++){if(strcmp(name,a[i].name)==0){printf("工作号,姓名,出生日期,性别,根本工资,津贴,总工资:\n");printf("%s %s %d %d %d %c %f %f %f\n",a[i].num,a[i].name,a[i].bir.year,a[i].bir.month,a[i].bir.day, a[i].sex,a[i].jbgz,a[i].jt,a[i].jbgz+a[i].jt);flag=1;}}if(flag==0)printf("查无此人!\n");}//查找根本工资最高的教师信息void searchbyjbgz(struct teacher a[],int n){struct teacher temp;int i;temp=a[0];for(i=1;i<n;i++){if(a[i].jbgz>temp.jbgz)temp=a[i];}printf("工作号,姓名,出生日期,性别,根本工资,津贴,总工资:\n");printf("%s %s %d %d %d %c %f %f %f\n",temp.num,,temp.bir.year,temp.bir.month,te mp.bir.day,temp.sex,temp.jbgz,temp.jt,temp.jbgz+temp.jt);}//修改指定职工号得教师信息void repeat(struct teacher a[],int n){char temp[20];int flag=0;int i;printf("请输入要修改的职工号:\n");getchar();gets(temp);for(i=0;i<n;i++){if(strcmp(temp,a[i].num)==0){printf("%s %s %d %d %d %c %f %f %f\n",a[i].num,a[i].name,a[i].bir.year,a[i].bir.month,a[i].bir.day, a[i].sex,a[i].jbgz,a[i].jt,a[i].jbgz+a[i].jt);printf("请重新输入职工号.姓名.出生日期.性别.根本工资.津贴:\n");scanf("%s %s %d %d %d %c %f %f",a[i].num,a[i].name,&a[i].bir.year,&a[i].bir.month,&a[i].bir.day, &a[i].sex,&a[i].jbgz,&a[i].jt);flag=1;}}if(flag==0)printf("查无此人!\n");printf("修改后的教师信息:\n");printf("职工号.姓名.出生日期.性别.根本工资.津贴.总工资:\n");for(i=0;i<n;i++)printf("%s %s %d %d %d %c %f %f %f\n",a[i].num,a[i].name,a[i].bir.year,a[i].bir.month,a[i].bir .day,a[i].sex,a[i].jbgz,a[i].jt,a[i].jbgz+a[i].jt);}void main(){int num;struct teacher tea[3];while(num=menu()){switch(num){case 1: input(tea,3); break;case 2: output(tea,3);break;case 3: sortbyzgz(tea,3);break;case 4: searchbyname(tea,3);break;case 5: searchbyjbgz(tea,3);break;case 6: repeat(tea,3);break;case 7: exit(0);}getch(); //按任意键继续system("cls"); //清屏}}。
高校人事管理系统程序设计源代码
目录新建一个头文件类,名字为:,再建一个源文件,名字随意,代码按顺序粘贴进去即可运行。
错误!未定义书签。
? 头文件:错误!未定义书签。
? 源文件:错误!未定义书签。
新建一个头文件类,名字为:,再建一个源文件,名字随意,代码按顺序粘贴进去即可运行。
头文件:#include <iostream>#include <fstream>using namespace std;dd(n1);i1++;}else if(b==2) dd(n2);i2++;}else if(b==3) dd(n3);i3++;}else if(b==4) dd(n4);i4++;}else if(b==5){break;}else{cout<<"输入有误!请重试!"<<endl;cout<<endl;system ("pause");system ("cls");continue;}}}ave(file);file<<endl;file<<i2<<endl; ave(file); file<<endl;file<<i3<<endl; ave(file); file<<endl;file<<i4<<endl; ave(file);();}Oxz; ead(file);}file>>i2; Ojs;ead(file);}file>>i3; Oyb;ead(file);}file>>i4; Otx;ead(file);}();}Oxz==g){h=g-1;xz[h].show();z=1;editPer(g,z); Ojs==g){h=g-1;js[h].show();z=2;editPer(g,z); Oyb==g){h=g-1;yb[h].show();z=3;editPer(g,z); Otx==g){h=g-1;tx[h].show();z=4;editPer(g,z); ame,nam)==0) {xz[t].show();x=1;editPer(xz[t].NOxz,x); Oxz,x);ame,nam)==0){js[t].show();x=2;editPer(js[t].NOjs,x); Ojs,x);ame,nam)==0){yb[t].show();x=3;editPer(yb[t].NOyb,x); Oyb,x);ame,nam)==0){tx[t].show();x=4;editPer(tx[t].NOtx,x); Otx,x);dd(n1);cout<<endl<<"是否保存(y/n)"<<endl;cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==2)js[n2].add(n2);cout<<endl<<"是否保存(y/n)"<<endl; cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==3){yb[n3].add(n3);cout<<endl<<"是否保存(y/n)"<<endl; cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==4)tx[n4].add(n4);cout<<endl<<"是否保存(y/n)"<<endl;cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}}else break;break;}}Oxz--; Ojs--; Oyb--; Otx--;职人员 2.党员 3.女性人员 4.高学历高职称人员"<<endl;int r;cin>>r;if(r==1){z=i1+i2+i3;cout<<"在职人员数:"<<z<<endl; }else if(r==2){for(i=0;i<i1;i++){if(strcmp(xz[i].zzmm ,"党员")==0) g++;}for(i=0;i<i2;i++){if(strcmp(js[i].zzmm,"党员")==0) g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zzmm,"党员")==0) g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zzmm,"党员")==0) g++;}cout<<"党员数:"<<g<<endl; }else if(r==3){for(i=0;i<i1;i++){if(strcmp(xz[i].sex,"女")==0)g++;}for(i=0;i<i2;i++){if(strcmp(js[i].sex,"女")==0)g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].sex,"女")==0)g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].sex,"女")==0)g++;}cout<<"女性人员数:"<<g<<endl; }else if(r==4){int g=0,h=0,c=0;for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"大学")==0)g++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"大学")==0)g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"大学")==0) g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zgxl,"大学")==0) g++;}for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"高中")==0) h++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"高中")==0) h++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"高中")==0) h++;for(i=0;i<i4;i++){if(strcmp(tx[i].zgxl,"高中")==0) h++;}for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"初中")==0) h++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"初中")==0) h++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"初中")==0) h++;}for(i=0;i<i4;i++)if(strcmp(tx[i].zgxl,"初中")==0)h++;}cout<<"大学人数:"<<g<<" 高中人数:"<<h<<" 初中人数:"<<c<<endl; }else{cout<<"统计的类型错误!"<<endl;system("PAUSE");}cout<<"是否继续人事统计:Y继续、其他退出"<<endl;char x;cin>>x;if(x!='y' && x!='Y')break;}}。
人事管理系统源代码
人事管理系统源代码第一篇:人事管理系统源代码#include #include #include #define N 100 struct member_info {char xm[7];char xb[3];char sr[15];char whcd[13];char zc[17];char sfzh[19];char lxdh[12];int gl;int nl;};struct member_info member[N+1];int CurrentCount=0;void input(){ char sfjx=1;while(sfjx!=0){if(CurrentCount==N){printf(“n人数已达上限,不能添加!!n”);sfjx=0;}else{CurrentCount++;printf(“n请输入员工信息(姓名性别生日年龄文化程度联系电话身份证号码工龄职称):n”);scanf(“%s%s%s%d%s%s%s%d%s”,member[CurrentCount] .xm,member[CurrentCount].xb,member[CurrentCount].sr,&mem ber[CurrentCount].nl,member[CurrentCount].whcd,member[Curr entCount].lxdh,member[CurrentCount].sfzh,&member[CurrentC ount].gl,member[CurrentCount].zc);printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}} printf(“人员已排序”);int i,j;for(i=1;ifor(j=CurrentCount;j>i;j--)if(strcmp(member[j].sfzh,member[j-1].sfzh)<0){member[0]=member[j];member[j]=member[j-1];member[j-1]=member[0];}printf(“n人事基本信息表n”);printf(“ 序号姓名性别生日年龄文化程度联系电话身份证号码工龄职称n”);for(i=1;i<=CurrentCount;i++)printf(“%4d %6s%3s%11s%3d%8s%12s%20s%3d%5sn”,i, member[i].xm,member[i].xb,member[i].sr,member[i].nl,member[i ].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,member[i].zc );system(“pause”);} voi d save(){FILE *fp;fp=fopen(“ygjbxx.txt”,“w”);if(fp==NULL)printf(“n文件打开不成功,信息无法保存!!n”);else{fprintf(fp,“%d”,CurrentCount);for(int i=1;i<=CurrentCount;i++)fprintf(fp,“n%8s%4s%16s%4d%14s%13s%20s%4d%18s”, member[i].xm,member[i].xb,member[i].sr,member[i].nl,member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,member[i].zc );fclose(fp);printf(“n信息已成功保存!!n”);}system(“pause”);} void read(){FILE *fp;fp=fop en(“ygjbxx.txt”,“r”);if(fp==NULL)printf(“n文件打开不成功,信息无法读取!!n”);else{fscanf(fp,“%d”,&CurrentCount);for(int i=1;i<=CurrentCount;i++){fscanf(fp,“%s%s%s%d%s%s%s%d%s”,member[i].xm,mem ber[i].xb,member[i].sr,&member[i].nl,member[i].whcd,member[i]. lxdh,member[i].sfzh,&member[i].gl,member[i].zc);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,member[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);}fclose(fp);p rintf(“n信息已成功读取!!n”);}system(“pause”);} void search(){char dcsfzh[19];int sfjx=1,i;while(sfjx!=0){printf(“n请输入一个待查员工的身份证号码:”);scanf(“%s”,dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf(“查无此人!!n”);else{printf(“n此人详细信息如下:n”);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,member[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);}prin tf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void del(){char dcsfzh[19];int sfjx=1,i,j;while(sfjx!=0){printf(“n请输入一个待删员工的身份证号码:”);scanf(“%s”,dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf(“查无此人!!n”);else{printf(“n此人详细信息如下:n”);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,member[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);printf(“n按任意键开始删除......n”);system(“pause”);for(j=i+1;j<=CurrentCount;j++)member[j-1]=member[j];CurrentCount--;printf(“n已成功删除......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void modify(){char dcsfzh[19];int sfjx=1,i;while(sfjx!=0){printf(“n请输入一个待修改员工的身份证号码:”);scanf(“%s”,dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf(“查无此人!!n”);else{printf(“n此人详细信息如下:n”);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,memb er[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);printf(“n请输入新内容......n”);printf(“n请输入人员相关信息(姓名性别生日年龄文化程度联系电话身份证号码工龄职称):”);scanf(“%s%s%s%d%s%s%s%d%s”,member[CurrentCount] .xm,member[CurrentCount].xb,member[CurrentCount].sr,&mem ber[CurrentCount].nl,member[CurrentCount].whcd,member[Curr entCount].lxdh,member[CurrentCount].sfzh,&member[CurrentC ount].gl,member[CurrentCount].zc);printf(“n已成功修改......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scan f(“%d”,&sfjx);}system(“pause”);} int check(){int count=0,name,pass;while(count<=2){printf(“n请输入用户名及密码:”);scanf(“%d%d”,&name,&pass);count++;if((name==1)&&(pass==1))count=10;elseif(count>2)count=5;}if(count==10)return 0;elsereturn 1;} struct mem_gz {float jbgz;float cql;float jj;float kk;float grsd;float sf;};struct mem_gz mem[N+1];void inputgz(){ char sfjx=1;CurrentCount=0;while(sfjx!=0){if(CurrentCount==N){printf(“n工资已添加完毕,无法添加!!n”);sfjx=0;}else{CurrentCount++;printf(“请输入身份证号码为:%s的员工工资资料n”,member[CurrentCount].sfzh);printf(“n请输入员工工资信息(基本工资考勤奖金扣款个人所得税):n”);scanf(“%f%f%f%f%f”,&mem[CurrentCount].jbgz,&mem[C urrentCount].cql,&mem[CurrentCount].jj,&mem[CurrentCount]. kk,&mem[CurrentCount].grsd);mem[CurrentCount].sf=mem[CurrentCount].jbgz*mem[Curr entCount].cql+mem[CurrentCount].jj-mem[CurrentCount].kk-mem[CurrentCount].grsd;}printf(“n是否继续(0--结束,其它--继续):n”);scanf(“%d”,&sfjx);}system(“pause”);} void savegz(){FILE *fq;fq=fopen(“yggzxx.txt”,“w”);if(fq==NULL)printf(“n文件打开不成功,信息无法保存!!n”);else{fprintf(fq,“%d”,CurrentCount);for(int i=1;i<=CurrentCount;i++)fprintf(fq,“n%f %f %f %f %f %f”,mem[i].jbgz,mem[i].cql,m em[i].jj,mem[i].kk,mem[i].grsd,mem[i].sf);fclose(fq);printf(“n信息已成功保存!!n”);}system(“pause”);} void readg z(){FILE *fq;fq=fopen(“yggzxx.txt”,“r”);if(fq==NULL)printf(“n文件打开不成功,信息无法读取!!n”);else{fscanf(fq,“%d”,&CurrentCount);for(int i=1;i<=CurrentCount;i++){fscanf(fq,“%f%f%f%f%f%f”,&mem[i].jbgz,&mem[i].cql,&m em[i].jj,&mem[i].kk,&mem[i].grsd,&mem[i].sf);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%fn”,mem[i].jbgz,mem[i].cql,mem[i].jj,mem[i].kk,mem[i].grsd ,mem[i].sf);}fclose(fq);printf(“n信息已成功读取!!n”);}system(“pause”);} void searchgz(){int dcbh;int sfjx=1;while(sfjx!=0){printf(“n请输入一个待查员工编号(身份证号从小到大的顺序):”);scanf(“%d”,&dcbh);if(dcbh<1||dcbh>CurrentCount)printf(“查无此人!!n”);else{printf(“n此人工资信息如下:n”);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f实发工资:%fn”,mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dc bh].kk,mem[dcbh].grsd,mem[dcbh].sf);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void delgz(){int dcbh;int sfjx=1,j;while(sfjx!=0){printf(“n请输入一个待删工资的编号:”);scanf(“%d”,&dcbh);if(dcbh<1||dcbh>CurrentCount)printf(“查无此人!!n”);else{printf(“n此人工资信息如下:n”);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%fn”,mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dc bh].kk,mem[dcbh].grsd,mem[dcbh].sf);printf(“n按任意键开始删除......n”);system(“pause”);for(j=dcbh+1;j<=CurrentCount;j++)mem[j-1]=mem[j];CurrentCount--;printf(“n已成功删除......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void modifygz(){int dcbh;int sfjx=1;while(sfjx!=0){printf(“n请输入一个待修改工资员工的编号:”);scanf(“%d”,&dcbh);if(dcbh<1||dcbh>CurrentCount)printf(“查无此人!!n”);else{printf(“n此人工资信息如下:n”);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%fn”,mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dc bh].kk,mem[dcbh].grsd,mem[dcbh].sf);printf(“n请输入新内容......n”);printf(“n请输入人员工资信息(基本工资考勤奖金扣款个人所得税实发工资):”);scanf(“%f%f%f%f”,&mem[CurrentCount].jbgz,&mem[dcb h].cql,&mem[dcbh].jj,&mem[dcbh].kk,&mem[dcbh].grsd,&mem [dcbh].sf);printf(“n已成功修改......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void lis tgz(){ int i;printf(“n员工工资信息表n”);printf(“ 序号基本工资考勤奖金扣款个人所得税实发工资n”);for(i=1;i<=CurrentCount;i++)printf(“%4d %8f%8f%8f%8f”,i,mem[i].jbgz,mem[i].cql,me m[i].jj,mem[i].kk,mem[i].grsd,mem[i].sf);system(“pause”);}void main(){int xz=1;printf(“*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*n”);printf(“*欢迎使用人事工资管理系统*n”);printf(“***************************************nnn”);if(check()!=0){printf(“n你无权使用本系统......nn”);system(“pause”);}else{while(xz!=0){printf(“n请选择相应功能:n”);printf(“1-录入n2-查询n3-修改n4-删除n5-保存n6-读取n7-输入员工工资n8-保存工资信息n9-读取工资信息n10-修改工资信息n11-删除工资信息n12-工资列表n0-结束n请输入选择:”);scanf(“%d”,&xz);switch(xz){case 1:input();break;case 2:search();break;case 3:modify();break;case 4:del();break;case 5:save();break;case 6:read();break;case 7:inputgz();break;case 8:savegz();break;case 9:readgz();break;case 10:modifygz();break;case 11:delgz();break;case 12:listgz();break;case 0:printf(“nn谢谢使用本系统!nn”);system(“pause”);break;default:printf(“n无此功能,请重新选择......n”);system(“pause”);}}} }第二篇:人事管理系统数据库源代码using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;using System.Xml.Linq;namespace WebApplication1 { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ Res ponse.Redirect(“~/登录.aspx”);}protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(“~/人员信息查询.aspx”);}protected void Button3_Click(object sender, EventArgs e){ Response.Redirect(“~/人员修改.aspx”);}protected void Button4_Click(object sender, EventArgs e){ Response.Redirect(“~/部门信息.aspx”);}protected void Button5_Click(object sender, EventArgs e){ Response.Redirect(“~/工资信息.aspx”);} } }using System;using System.Collections;usingSystem.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 部门信息: System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ bool find =false;SqlConnection con=new SqlConnection(“server=localhost;IntegratedSecurity=SSPI;database=人事管理系统”);con.Open();string cmdstr=“select * from 部门表”;SqlDataAdapter da=new SqlDataAdapter(cmdstr,con);DataSet ds=new DataSet();da.Fill(ds);for(int i=0;iTextBox2.Text=ds.T ables[0].Rows[i][“部门代码”].ToString();TextBox3.T ext=ds.Tables[0].Rows[i][“部门名称”].T oString();find=true;}} } if(find == false){ Response.Write(“”);con.Close();} }protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(“~/Default.aspx”);} } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;using System.Data.SqlTypes;namespace WebApplication1 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void TextBox1_TextChanged(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){SqlConnection con = new SqlConnection(“server=localhost;IntegratedSecurity=SSPI;database=人事管理系统”);string strCount;strCount = “select * from 人事表”;con.Open();SqlCommand com = new SqlCommand(strCount, con);SqlDataReader dr = com.ExecuteReader();string strUsername = “", strPassword = ”“;while(dr.Read()){ if(TextBox1.Text == dr[”编号“].ToString()||TextBox2.Text == dr[”用户密码“].ToString()){ strUsername = dr[”编号“].T oString();strPassword = dr[”用户密码“].ToString();break;} } dr.Close();con.Close();if(strUsername== ”“){ Response.Write(”“);return;}}protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx“);} } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;usingSystem.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 工资信息 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void TextBox2_TextChanged(object sender, EventArgs e){}protected void TextBox5_TextChanged(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ bool find = false;SqlConnection con = new SqlConnection(”server=localhost;IntegratedSecurity=SSPI;database=人事管理系统“);con.Open();string cmdstr = ”select * from 工资表“;SqlDataAdapter da = new SqlDataAdapter(cmdstr, con);DataSet ds = new DataSet();da.Fill(ds);for(int i = 0;i < ds.Tables[0].Rows.Count;i++){ for(int j = 0;j < ds.Tables[0].Columns.Count;j++){ String data =(ds.Tables[0].Rows[i][j].ToString()).Trim();if(data == TextBox1.Text.Trim()){TextBox2.Text = ds.Table s[0].Rows[i][”应发工资“].ToString();TextBox3.Text = ds.Tables[0].Rows[i][”岗位津贴“].ToString();TextBox4.Text = ds.Tables[0].Rows[i][”奖励“].ToString();TextBox5.Text = ds.Tables[0].Rows[i][”保险“].ToString();} } if(find == false){ Response.Write(”“);con.Close();}}protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx“);} } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 人员信息: System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx“);}protected void Button2_Click(object sender, EventArgs e){ bool find =false;SqlConnection con = new S qlConnection(”server=localhost;IntegratedSecurity=SSPI;database=人事管理系统“);con.Open();string cmdstr=”select * from 工资表“;SqlDataAdapter da=new SqlDataAdapter(cmdstr,con);DataSet ds=new DataSet();da.Fill(ds);for(int i=0;iTextBox2.Text=ds.T ables[0].Rows[i][”应发工资“].ToString();TextBox3.Text=ds.Tables[0].Rows[i][”岗位津贴“].ToString();TextBox4.Text=ds.Tables[0].Rows[i][”奖励“].ToString();TextBox5.Text = ds.Tables[0].Rows[i][”保险“].ToString();} } if(find == false){ Response.Write(”“);con.Close();} } } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 人员修改: System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void TextBox5_TextChanged(object sender, EventArgs e){}protected void Button2_Click(object sender, EventArgs e){ SqlConnection con=new SqlConnection(”server=localhost;IntegratedSecurity=SSPI;database=人事管理系统“);con.Open();string insert=”insert into 人事表(员工号,姓名,性别,职称,学历)values(“+”“+ TextBox1.Text.Trim()+”“+”,“+”“ + TextBox2.Text.Trim()+”“+”,“+TextBox3.Text.Trim()+ ”,“ +”“+ TextBox4.Text.Trim()+”“+”,“+”“ +TextBox5.Text.Trim()+ ”“+”)“;Response.Write(insert);SqlCommand cmd1=new SqlCommand(insert,con);con.Close();}protected void Button1_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx");}protected void GridView1_SelectedIndexChanged(object sender, EventArgs e){ } } }第三篇:人事管理系统企业人事财务管理系统的开发与设计内容摘要随着Internet的不断发展,传统的管理方式,消耗大量的人力物力,传统的方式已经赶不上时代的脚步,所以开发一个高效的企业人事财务管理系统,是非常必要的。
C课程设计教职工信息管理系统源代码
教职工信息管理系统源码#include<iostream.h>#include<string.h>#include<fstream.h>#include<stdlib.h>#define maxsize 100fstream iofile; //文件指针class Time //时间类{public:int year;int month;int day;};class Telem //个人信息{public:char name[20];char sex[10];Time birthtime; //组合Time类char num[20];char wage[20];Time worktime;int year;char department[20];friend istream& operator>>(istream& input,Telem& T);friend ostream& operator<<(ostream& output,Telem& T);friend int operator-(Time & t1,Time & t2);};class People:virtual public Telem //雇员类{public:People();virtual void AddF()=0; //添加virtual void Addall()=0;virtual void Add()=0;virtual void Display(); //输出数组的内容virtual void Displaypart(char p[]);virtual void Findname(char n[]);virtual void Findyear(int );virtual void Del(char n[])=0;virtual void Del(int ); protected:Telem data[maxsize];Time now;int length;};class Teacher:virtual public People //派生虚基类{public:virtual void AddF();virtual void Addall();virtual void Add();virtual void Display();virtual void Del(int i);virtual void Del(char n[]);};class worker:virtual public People //派生虚基类{public:virtual void AddF();virtual void Addall();virtual void Add();virtual void Display();virtual void Del(int i);virtual void Del(char n[]);};People::People() //系统自动生成的构造函数{length=0;now.year=2010;now.month=7;now.day=6;}void People::Display() //引用{int i;for(i=0;i<length;i++)cout<<data[i];}void People::Displaypart(char p[])//引用数组{int i,c;for(i=0;i<length;i++)if(strcmp(data[i].wage,p)==0){cout<<"输出选择姓名1 性别2 编号3 工资4 出生日期5 工作时间6 年龄7 系别8 退出选择9"<<endl;while(cin>>c){switch(c){ case 1: cout<<"姓名:"<<data[i].name<<endl;break;case 2: cout<<"性别:"<<data[i].sex<<endl;break;case 3: cout<<"编号:"<<data[i].num<<endl;break;case 4: cout<<"工资:"<<data[i].wage<<endl;break;case 5: cout<<"出生日期:"<<data[i].birthtime.year<<" "<<data[i].birthtime.month<<" "<<data[i].birthtime.day<<" "<<endl;break;case 6: cout<<"工作时间:"<<data[i].worktime.year<<" "<<data[i].worktime.month<<" "<<data[i].worktime.day<<" "<<endl;break;case 7: cout<<"年龄:"<<data[i].year<<endl;break;case 8: cout<<"系别:"<<data[i].department<<endl;break;case 9: goto loop;default:cout<<"操作错误......"<<endl;}}loop:;}}void People::Findname(char n[]) //引用{int i;for(i=0;i<length;i++)if(strcmp(data[i].name,n)==0) //对象引用cout<<data[i];}void People::Findyear(int y){int i;for(i=0;i<length;i++)if(data[i].year==y)cout<<data[i];}void People::Del(int i){int j;if(i<1||i>length)cout<<"不存在第"<<i<<"个元素";for(j=i;j<length;j++)data[j-1]=data[j];length--;}void worker::AddF(){int flag=0;iofile.open("worker_information.txt",ios::in|ios::binary); //文件的打开与关闭while(iofile.seekg(ios::cur)){iofile.seekg(length*sizeof(data[length]),ios::beg);iofile.read((char*)&data[length],sizeof(data[length])); //文件的随机访问length++;if(length==maxsize){flag=1;goto loop;}}People::Del(length);cout<<"添加人员信息成功......"<<endl;loop:if(1==flag)cout<<"人员信息储存空间已满......"<<endl;iofile.close();}void worker::Addall(){char ans;int flag=0;iofile.open("worker_information.txt",ios::out|ios::binary);do{cin>>data[length];data[length].year=now-data[length].birthtime;iofile.write((char*)&data[length],sizeof(data[length]));cout<<"添加人员信息成功......"<<endl;length++;if(length==maxsize){flag=1;goto loop;}cout<<"contine(Y|N)?";cin>>ans;}while('y'==ans||'Y'==ans);loop:if(1==flag)cout<<"人员信息储存空间已满......"<<endl;iofile.close();}void worker::Add(){int flag=0;iofile.open("worker_information.txt",ios::app|ios::out|ios::binary);if(length==maxsize){flag=1;goto loop;}cin>>data[length];data[length].year=now-data[length].birthtime;iofile.write((char*)&data[length],sizeof(data[length]));cout<<"添加人员信息成功......"<<endl;length++;loop:if(1==flag)cout<<"人员信息储存空间已满......"<<endl;iofile.close();}void worker::Display(){cout<<" ★☆★☆★☆★☆★☆工人信息★☆★☆★☆★☆★☆"<<endl;if(0==length)cout<<"无......"<<endl;int i;for(i=0;i<length;i++)cout<<data[i];}void worker::Del(char n[]){int i,j,k;for(i=0;i<length;i++)if(strcmp(data[i].name,n)==0){k=i+1;break;}if(k<1)cout<<"不存在姓名"<<n<<"的人员信息";for(j=k;j<length;j++)data[j-1]=data[j];length--;cout<<"删除人员信息成功......"<<endl;}void worker::Del(int i){int j;if(i<1||i>length)cout<<"不存在第"<<i<<"个元素";for(j=i;j<length;j++)data[j-1]=data[j];length--;cout<<"删除成功......"<<endl;}void Teacher::AddF(){int flag=0;iofile.open("Teacher_information.txt",ios::in|ios::binary);while(iofile.seekg(sizeof(data[length]),ios::cur)){if(iofile.seekg(length*sizeof(data[length]),ios::beg))iofile.read((char*)&data[length],sizeof(data[length]));elsebreak;length++;if(length==maxsize){flag=1;goto loop;}}People::Del(length);cout<<"添加人员信息成功......"<<endl;loop:if(1==flag)cout<<"人员信息储存空间已满......"<<endl;iofile.close();}void Teacher::Addall(){char ans;int flag=0;iofile.open("Teacher_information.txt",ios::in|ios::out|ios::binary);do{cin>>data[length];data[length].year=now-data[length].birthtime;iofile.write((char*)&data[length],sizeof(data[length]));cout<<"添加人员信息成功......"<<endl;length++;if(length==maxsize){flag=1;goto loop;}cout<<"contine(Y|N)?";cin>>ans;}while('y'==ans||'Y'==ans);loop:if(1==flag)cout<<"人员信息储存空间已满......"<<endl;iofile.close();}void Teacher::Add(){int flag=0;iofile.open("Teacher_information.txt",ios::app|ios::out|ios::binary);if(length==maxsize){flag=1;goto loop;}cin>>data[length];data[length].year=now-data[length].birthtime;iofile.write((char*)&data[length],sizeof(data[length]));cout<<"添加人员信息成功......"<<endl;length++;loop:if(1==flag)cout<<"人员信息储存空间已满......"<<endl;iofile.close();}void Teacher::Display(){cout<<" ★☆★☆★☆★☆★☆教师信息★☆★☆★☆★☆★☆"<<endl;if(0==length)cout<<"无......"<<endl;int i;for(i=0;i<length;i++)cout<<data[i];}void Teacher::Del(char n[]){int i,j,k;for(i=0;i<length;i++)if(strcmp(data[i].name,n)==0){k=i+1;break;}if(k<1) cout<<"不存在姓名"<<n<<"的人员信息";for(j=k;j<length;j++)data[j-1]=data[j];length--;cout<<"删除人员信息成功......"<<endl;}void Teacher::Del(int i){int j;if(i<1||i>length)cout<<"不存在第"<<i<<"个元素";for(j=i;j<length;j++)data[j-1]=data[j];length--;cout<<"删除成功......"<<endl;}istream& operator>>(istream& input,Telem& T){int y,m,d;cout<<"请输入姓名(以*结尾):"<<endl;input.getline(,20,'*');cout<<"请输入性别(以*结尾男或女):"<<endl;input.getline(T.sex,10,'*');cout<<"编号(以*结尾):"<<endl;input.getline(T.num,20,'*');cout<<"工资(以*结尾):"<<endl;input.getline(T.wage,20,'*');cout<<"请输入出生日期:"<<endl;input>>y>>m>>d;;;;cout<<"请输入系别(以*结尾):"<<endl;input.getline(T.department,20,'*');cout<<"参加工作时间:"<<endl;input>>y>>m>>d;;;;return input;}ostream& operator<<(ostream& output,Telem& T) {cout<<"姓名:";output<<<<endl;cout<<"性别:";output<<T.sex<<endl;cout<<"编号:";output<<T.num<<endl;cout<<"工资:";output<<T.wage<<endl;cout<<"出生日期:";output<<" "<<" "<<;cout<<"系别:";output<<T. department<<endl;cout<<"参加工作时间:";output<<" "<<" "<<;cout<<"年龄:";output<<T.year<<endl;return output;}int operator-(Time & t1,Time & t2){return t1.year-t2.year;}void Showmenu(){cout<<endl;cout<<" 欢迎进入教职工信息管理系统"<<endl<<endl;cout<<" 2010 年7月7日发布"<<" 版权所有:swa"<<endl<<endl<<endl;cout<<" ★☆★☆★☆★☆★人员信息管理系统★☆★☆★☆★☆★"<<endl<<endl;cout<<" ★1-从键盘录入全部人员记录☆"<<endl<<endl;cout<<" ☆2-增加一位人员记录★"<<endl<<endl;cout<<" ★3-显示全部人员记录☆"<<endl<<endl;cout<<" ☆4-按系别输出人员信息(可选)★"<<endl<<endl;cout<<" ★5-按姓名或年龄检索所有信息☆"<<endl<<endl;cout<<" ☆6-显示菜单目录★"<<endl<<endl;cout<<" ★7-结束程序运行☆"<<endl<<endl;cout<<" ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆"<<endl;}int main(){Teacher tea;worker stu;People *pt=&tea;People *ps=&stu;int c=0,k=0,l=0,i=0;char nam[20],part[20];Showmenu();for(;;){cout<<"请根据菜单执行相应操作: ";cin>>c;switch(c){case 1:{cout<<" ★☆★☆★☆★录入全部人员记录★☆★☆★☆★"<<endl;cout<<" ★☆★☆★从键盘输入教师信息☆★☆★☆"<<endl;pt->Addall();cout<<" ★☆★☆★☆★☆★☆从键盘输入工人信息★☆★☆★☆★☆★☆"<<endl;ps->Addall();break;}case 2:{cout<<" ★☆★☆★☆★☆从键盘增加一位人员记录★☆★☆★☆★☆"<<endl;cout<<" ★☆★☆★☆★☆教师操作请按1 工人操作请按2 ★☆★☆★☆★☆"<<endl;cin>>k;if(1==k)pt->Add();else if(2==k)ps->Add();elsecout<<"操作错误..."<<endl;break;}case 3:{cout<<" ★☆★☆★☆★☆★☆显示全部人员记录★☆★☆★☆★☆★☆"<<endl;pt->Display();ps->Display();break;}case 4:{cout<<" ★☆★☆★☆★☆★☆按部门输出人员信息(可选)★☆★☆★☆★☆★☆"<<endl;cout<<" ★☆★☆★☆教师操作请按1 工人操作请按2 ★☆★☆★☆"<<endl;cin>>k;if(1==k){cout<<"请输入要输出人员的系别(以*结尾):"<<endl;cin.getline(part,20,'#');pt->Displaypart(part);}else if(2==k){cout<<"请输入要输出人员的系别(以*结尾):"<<endl;cin.getline(part,20,'#');ps->Displaypart(part);}elsecout<<"操作错误......"<<endl;break;}case 5:{cout<<" ★☆★☆★☆★按姓名或年龄检索所有信息★☆★☆★☆★"<<endl;cout<<" ★☆★☆★☆★按姓名查找1 按年龄查找2 ★☆★☆★☆★"<<endl;cin>>k;if(1==k){cout<<"按姓名查找1 按年龄查找2"<<endl; cin>>l;if (1==l){cout<<"请输入要查找人员的姓名(以*结尾):"<<endl;cin.getline(nam,20,'#');pt->Findname(nam);}else if(2==l){cout<<"请输入要查找人的年龄:"<<endl;cin>>i;pt->Findyear(i);}elsecout<<"操作错误......"<<endl;}else if(2==k){cout<<"按姓名查找1 按年龄查找2"<<endl; cin>>l;if (1==l){cout<<"请输入要查找人员的姓名(以*结尾):"<<endl;cin.getline(nam,20,'#');ps->Findname(nam);}else if(2==l){cout<<"请输入要查找人的年龄:"<<endl;cin>>i;ps->Findyear(i);}elsecout<<"操作错误......"<<endl;}elsecout<<"操作错误......"<<endl;break;}case 6:{cout<<" ★☆★☆★☆★☆★☆显示菜单目录★☆★☆★☆★☆★☆"<<endl;Showmenu();break;}case 7:{cout<<" ★☆★☆★☆★☆★☆结束程序运行★☆★☆★☆★☆★☆"<<endl;exit(0);}default:cout<<"操作错误......"<<endl;}}return 0;}。
高校人事管理系统C++代码
#include〈iostream〉#include<string>#include<fstream〉powered by #include<iomanip>using namespace std;class employee{protected:int number;char name[20];char sex[6];char workplace[20];char place[20];char nation[6];char birth[20];char party[10];char id[20];float score[5];public:Employee *nest;Employee(){}~Employee(){}char* getname(){ return name;}int getnumber(){return number;}double getscore(int i){ return score[i];}float get(){return(score[0]+ score[1]+ score[2]+ score[3]+ score[4]);} void input(){int e=1;cout<〈“\t\t\t按提示输入 :”<<endl ;cout〈〈“\t\t输入工号 :”;cin〉〉workplace ;do{cout〈〈“\t\t输入性别 :” ;cin〉〉sex ;if(strcmp(sex,“man”)==0 ||strcmp(sex,“woman”)==0){cout<<“\t\t输入籍贯:”;cin 〉>place;cout〈〈“\t\t输入民族:”;cin >〉nation;cout<<“\t\t输入生日:”;cin 〉>birth;cout<<“\t\t输入政治面貌:”;cin 〉〉party;cout<〈“\t\t输入身份证号:”;cin 〉〉id;cout<<“\t\t输入工作时间:";cin >>score[0];cout〈<“\t\t输入缺勤次数:”;cin >>score[1];cout<<“\t\t输入业绩总评成绩:";cin >〉score[2];cout〈〈“\t\t输入跳动工作次数:";cin 〉〉score[3];cout〈<“\t\t输入目前工资:”;cin 〉>score[4];e=0;}else{cout<<“\t\t\t无此类型性别!重新输入!”<〈endl ;e=1 ;}}while(e);return ;}void input(ifstream &is){is>>number〉>name〉〉sex〉〉place>〉nation〉〉birth〉〉party>〉id >〉score[0]>〉score[1]>> score[2]>> score[3]〉〉score[4]; is.get();}void output(){cout〈〈“职工基本信息如下:”<<endl;cout<<“工号:"〈<number〈〈“姓名:”〈<name<<“性别:”〈〈sex〈<“籍贯:”<〈place<〈“民族:"<〈nation〈〈“工作单位:”〈<workplace〈<“生日:”〈<birth〈〈“政治面貌:”<〈party〈<endl<<“身份证号:”〈<id〈〈“工作时间:”<〈score[0]〈<“缺勤次数:”〈< score[1]〈<“业绩总评成绩:”<〈score[2]<<“调动工作次数:”〈<score[3]〈〈“目前工资:"<〈score[4]<<endl;}void output(ofstream &os){os〈<setw(6)〈<number<<setw(15)<<name〈〈setw(6)〈〈sex〈<setw(20)<<place〈〈setw(6)〈〈nation<〈setw(20)<<workplace〈〈setw(20)〈〈birth〈〈setw(20)<<party〈〈setw(20)<<id<<setw(6)<〈score[0]<〈setw(6)〈< score[1]<〈setw(6)〈< score[2]<〈setw(6)〈< score[3]〈<setw(6)〈〈score[4]〈〈endl;}};class company{Public:company(){head=new Employee;head—>next=NULL;key=0;} ~company(){delete head;}void input();void mend();void del();int find(Employee**p,int num,char *pn=“^”);void found();void show();void save();void begin();void clear;char mainmenu();int getkey(){return key;}void setkey(int k)(key=k;)Employee *head;int key;};Void company::input(){Employee *p,*p2=NULL;P=head;int n;while(p->next)p=p-〉next;while(n){p2=new Employee;p2->input();p—〉next=p2;p2—〉next=NULL;p=p—>next;company::setkey(1);cout〈〈”\t\t\t按1继续,按0返回:";cin>>n;}}int company::find(Employee **p1,int num,char *pn){Employee *p;p=head;while(p-〉next){(*p1)=p;if((p—>next)—>getnumber()==num!strcmp((p->next)—>getname(),pn))return 1;p=p->next;}return 0;}void company::found(){Employee *p;int num=—1,n=9;char name[20]=”^”;{cout〈<”\t\t1:按工号查找,2:按姓名查找:";cin>>n;}while(n〈1||n>2);if(n==1){cout〈〈”\t\t\t输入工号:";cin〉〉num;}if(n==2){cout<<”\t\t\t输入姓名:”;cin>>name;}if(!find(&p,num,name)){cout<〈”\t\t找不到你要查找的内容!”〈<endl;return;}(p-〉next)->output();}V oid company::del(){Employee *p,*p2;int num;cout<〈”\t\t\t输入工号:”;cin〉〉num;if(!find(&p,num,”^”)){cout〈〈”\t\t找不到你要删除的内容!”<〈endl;return;}(p-〉next)->output();p2=p—〉next;p—>next=p2-〉next;delete p2;company::setkey(1);}void company::show(){Employee::*p;p=head;while(p->next){(p—>next)-〉output();p=p—>next;}}void company::mend(){Employee *p;int num=-1,n;char name[20]=”^”;do{cout<〈”\t\t1:按工号修改,2:按姓名修改:”;cin〉〉n;}while(n〈1||n〉2);if(n==1){cout〈〈”\t\t\t输入工号:”;cin>>num;}if(n==2){cout<〈"\t\t\t输入姓名:";cin>〉num;}if(!find(&p,num,name)){cout〈<”\t\t找不到你要修改的内容!”〈〈endl;return;}(p->next)->output();(p-〉next)-〉input();Company::setkey(1);}void company::save(){Employee *p;p=head;ofstream os(“Employee.txt”,ios::out);if(company::getkey()==1){while(p—>next){(p->next)—>output(os);p=p-〉next;}}cout<〈”\t\t\t文件已保存!”<<endl ;company ::setkey(0);}void company ::begin(){Employee *p,*p2 ;p=head;clear();long t;ifstream is(“Employee。
C#实验报告(人事管理系统)
C#实验报告(人事管理系统)学号149074353姓名程裕博班级物141指导教师夏敏安徽工业大学计算机学院2016年12月一.程序步骤先设置一个登录界面(连接数据库),登录时进行判断,根据不同的错误信息进行报错,如密码错误。
登陆成功后,进入主界面。
主界面通过树和表格来显示数据。
可以对人员,班组,部门进行增删改查操作,数据保存在数据库中。
二.程序源码1.数据库表结构2、登录界面using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using CCWin;using System.Data.SqlClient;namespace实验__人事管理系统{public partial class Form_login : CCSkinMain{public Form_login(){InitializeComponent();}string src = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=c:\users\博博\documents\visual studio 2013\Projects\实验——人事管理系统\实验——人事管理系统\MyData.mdf;Integrated Security=True";private void Form1_Load(object sender, EventArgs e){}private void button_login_Click(object sender, EventArgs e){string user = this.skinTextBox.Text;string password = this.skinTextBox2.Text;int sign1 = 0;int sign2 = 0;if (user == "" || password == "")MessageBox.Show("您输入的数据不完整!");else{string sql1 = string.Format("select USERNAME from [Table_login] where USERNAME=N'{0}';", user);using (SqlConnection coon = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql1, coon);coon.Open();using (SqlDataReader dr = cmd.ExecuteReader()){while (dr.Read()){sign1++;}}}if (sign1 == 0)MessageBox.Show("未查询到您的用户信息!");if (sign1 != 0){string sql2 = string.Format("select PASSWORD from [Table_login] where USERNAME=N'{0}';", user);using (SqlConnection coon = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql2, coon);coon.Open();using (SqlDataReader dr = cmd.ExecuteReader()){while (dr.Read()){if (password == dr["PASSWORD"].ToString())sign2++;}}}}if (sign1 != 0 && sign2 == 0)MessageBox.Show("您的密码输入错误!");if (sign2 != 0){Form_show f1 = new Form_show(user, this);f1.Show();this.Visible = false;}}}}}3、主界面using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Timers;using System.Data.SqlClient;using CCWin;namespace实验__人事管理系统{public partial class Form_show : Form{public Form_show(){InitializeComponent();}public Form_show(string name1,Form_login f){login_name=name1;fl = f;InitializeComponent();}string login_name="xx";Form_login fl =null ;TreeNode t = new TreeNode();int ID=-1;public List<person> list = new List<person>();string name;string birth;string sex;string education;string adminisitrator;string manegetime;// string category_name;string src = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=c:\users\博博\documents\visual studio 2013\Projects\实验——人事管理系统\实验——人事管理系统\MyData.mdf;Integrated Security=True";private void Form_show_Load(object sender, EventArgs e){toolStripStatusLabel_name.Text = "管理员:" + this.login_name; toolStripStatusLabel_time.Text = "登录时间:" +DateTime.Now.ToLongTimeString();Addparent();this.dataGridView1.ClearSelection();}private void toolStripStatusLabel_name_Click(object sender, EventArgs e) {}private void Form_show_FormClosed(object sender, FormClosedEventArgs e) {fl.Close();}public void Addparent(){string sql = "select * from [Table_tree] where PR_NUMBER=-1";using (SqlConnection coon = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql, coon);coon.Open();using (SqlDataReader dr = cmd.ExecuteReader()){while (dr.Read()){string name = dr["NAME"].ToString();string number = dr["NUMBER"].ToString();// string category=dr["CATEGORY"].ToString();TreeNode tn = new TreeNode();tn.Text = name;tn.Tag = number;tn.ImageIndex = 1;AddChild(number, tn);treeView_jiegou.Nodes.Add(tn);// skinTreeView1.Nodes.Add(tn);}}}}private void AddChild(string pnumber, TreeNode pnode){if (Convert.ToInt32(pnode.Tag) == 0 || (pnode.Parent!=null &&Convert.ToInt32(pnode.Parent.Tag) == 0)){string sql = "select * from [Table_tree] where PR_NUMBER=" + pnumber + "order by NAME desc;";using (SqlConnection conn = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql, conn);conn.Open();using (SqlDataReader dr = cmd.ExecuteReader()){while (dr.Read()){string name = dr["NAME"].ToString();string number = dr["NUMBER"].ToString();// string category = dr["CATEGORY"].ToString();TreeNode tn = new TreeNode();tn.Text = name;tn.Tag = number;tn.ImageIndex = 1;AddChild(number, tn);pnode.Nodes.Add(tn);}}}}else{string sql = "select * from [Table_tree] where PR_NUMBER=" + pnumber + "order by NAME desc;";using (SqlConnection conn = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql, conn);conn.Open();using (SqlDataReader dr = cmd.ExecuteReader()){while (dr.Read()){string name = dr["NAME"].ToString();string number = dr["NUMBER"].ToString();// string category = dr["CATEGORY"].ToString();TreeNode tn = new TreeNode();tn.Text = name;tn.Tag = number;tn.ImageIndex = 0;AddChild(number, tn);pnode.Nodes.Add(tn);}}}}}private void skinButton_add_Click(object sender, EventArgs e)//无用的按钮{}private void skinButton_add_Click_1(object sender, EventArgs e){//MessageBox.Show("添加!");if (t.Parent.Parent!=null && t.Parent!=null){Form_Addperson fp = new Form_Addperson(t, toolStripStatusLabel_name.Text, DateTime.Now.ToString());fp.Owner = this;fp.Show();list.Clear();}elseMessageBox.Show("请到班组添加人员!");// reshow();}private void treeView_jiegou_AfterSelect(object sender, TreeViewEventArgs e){string sql = "select * from Table_person where CATEGORY_NUMBER="+ e.Node.Tag;List<person> list = new List<person>();using (SqlConnection conn = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql, conn);conn.Open();using (SqlDataReader dr = cmd.ExecuteReader()){while (dr.Read()){person p = new person();p.Person_name = dr["PERSON_NAME"].ToString();p.Category_name = dr["CATEGORY_NAME"].ToString();p.Sex = dr["SEX"].ToString();string []dt=dr["BIRTH"].ToString().Split(' ');p.Birth = dt[0];cation = dr["EDUCATION"].ToString();p.Adminisitrator = dr["ADMINISITRATOR"].ToString();p.Manegetime=dr["MANEGETIME"].ToString();list.Add(p);}}this.dataGridView1.ClearSelection();this.dataGridView1.DataSource = list;ID = -1;}}private void添加部门ToolStripMenuItem_Click(object sender, EventArgs e){if (t.Parent == null || t.Parent.Parent == null){Form_Add fa = new Form_Add(t);fa.Owner = this;fa.Show();}else{Form_Addperson fp = new Form_Addperson(t, toolStripStatusLabel_name.Text, DateTime.Now.ToString());fp.Owner = this;fp.Show();list.Clear();this.dataGridView1.DataSource = list;}}private void treeView_jiegou_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e){this.t = e.Node;// MessageBox.Show();}public void reshow(){treeView_jiegou.Nodes.Clear();Addparent();}private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) {//string name;//string birth;////string education;//string adminisitrator;//string manegetime;if (e.RowIndex != -1){name = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();birth = this.dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();education =this.dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString();adminisitrator =this.dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString();manegetime =this.dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString();sex = this.dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();//MessageBox.Show(name+birth+education+adminisitrator+manegetime+sex);string sql = string.Format("select ID from Table_person wherePERSON_NAME=N'{0}' and BIRTH=N'{1}' and ADMINISITRATOR=N'{2}' and MANEGETIME=N'{3}'", name, birth, adminisitrator, manegetime);// MessageBox.Show(sql);using (SqlConnection coon = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql, coon);coon.Open();using (SqlDataReader dr = cmd.ExecuteReader()){while (dr.Read()){ID = (int)dr["ID"];}}}}}private void skinButton_delete_Click(object sender, EventArgs e){if (ID != -1){string sql = "delete from Table_person where ID="+ID.ToString()+";";using (SqlConnection coon = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql,coon);coon.Open();int n=cmd.ExecuteNonQuery();if(n==1){MessageBox.Show("删除成功!");reshowview();reshow();}//foreach (person p in list)//{// if (p.Adminisitrator == adminisitrator && p.Birth == birth && p.Person_name == name && p.Manegetime == manegetime)// {// list.Remove(p);// }//}//this.dataGridView1.DataSource = list;}}else{MessageBox.Show("未选定行!");}}private void skinButton_rewrite_Click(object sender, EventArgs e){if (ID != -1){Form_rewrite fr = new Form_rewrite(name, sex, birth, education, toolStripStatusLabel_name.Text, manegetime, ID);fr.Owner = this;fr.Show();}elseMessageBox.Show("未选定行!");//list.Clear();// this.dataGridView1.DataSource=list;}private void skinButton1_search_Click(object sender, EventArgs e){string sql = "select * from Table_person where 1=1";List<person> list1 = new List<person>();// list1.Clear();if (this.textBox1.Text.Trim() != "")sql = sql + " and PERSON_NAME like N'%"+ this.textBox1.Text.Trim()+ "%'";if (this.textBox2.Text.Trim() != "")sql = sql + " and CATEGORY_NAME like N'%"+ this.textBox2.Text.Trim()+ "%'"; sql += ";";using (SqlConnection conn = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql, conn);conn.Open();using (SqlDataReader dr = cmd.ExecuteReader()){while (dr.Read()){person p = new person();p.Person_name = dr["PERSON_NAME"].ToString();p.Category_name = dr["CATEGORY_NAME"].ToString();p.Sex = dr["SEX"].ToString();string[] dt = dr["BIRTH"].ToString().Split(' ');p.Birth = dt[0];cation = dr["EDUCATION"].ToString();p.Adminisitrator = dr["ADMINISITRATOR"].ToString();p.Manegetime = dr["MANEGETIME"].ToString();list1.Add(p);}}this.dataGridView1.ClearSelection();this.dataGridView1.DataSource = list1;}}private void skinButton_reset_Click(object sender, EventArgs e){this.textBox1.Text = "";this.textBox2.Text = "";List<person> list1 = new List<person>();this.dataGridView1.DataSource = list1;}public void reshowview(){List<person> list1 = new List<person>();list1.Clear();this.dataGridView1.DataSource = list1;}private void删除部门ToolStripMenuItem_Click(object sender, EventArgs e) {Form_delete fm_delete = new Form_delete(t);fm_delete.Owner = this;fm_delete.Show();}private void修改单位ToolStripMenuItem_Click(object sender, EventArgs e) {Form_rename rename = new Form_rename(t, t.Text.ToString());rename.Owner = this;rename.Show();}}}4、人员类using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace实验__人事管理系统{public class person{private string person_name;public string Person_name{get { return person_name; }set { person_name = value; } }private string category_name;public string Category_name{get { return category_name; }set { category_name = value; } }private string birth;public string Birth{get { return birth; }set { birth = value; }}private string sex;public string Sex{get { return sex; }set { sex = value; }}private string education;public string Education{get { return education; }set { education = value; }}private string adminisitrator;public string Adminisitrator{get { return adminisitrator; }set { adminisitrator = value; }}private string manegetime;public string Manegetime{get { return manegetime; }set { manegetime = value; }}}}5、删除界面using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Data.SqlClient;using CCWin;namespace实验__人事管理系统{public partial class Form_delete : CCSkinMain{public Form_delete(){InitializeComponent();}public Form_delete(TreeNode node){InitializeComponent();this.t = node;}TreeNode t = new TreeNode();string src = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=c:\users\博博\documents\visual studio 2013\Projects\实验——人事管理系统\实验——人事管理系统\MyData.mdf;Integrated Security=True";private void Form_delete_Load(object sender, EventArgs e){}private void skinButton_sure_Click(object sender, EventArgs e){if (t != null && t.Parent != null){if (t.Parent.Tag.ToString() == "0"){// /ox.Show(t.Tag.ToString()+":"+t.Text);string sql1 = "delete from Table_person where CATEGORY_NUMBERin(select NUMBER from Table_tree where PR_NUMBER in(select NUMBER from Table_tree where NAME=N'" + t.Text + "'));";// MessageBox.Show(sql1);using (SqlConnection coon = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql1, coon);coon.Open();int n = cmd.ExecuteNonQuery();// MessageBox.Show("您已经删除了" + n.ToString() + "条数据!");}string sql2 = "delete from Table_tree where PR_NUMBER in(select NUMBER from Table_tree where NAME=N'" + t.Text + "');";// MessageBox.Show(sql2);using (SqlConnection coon = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql2, coon);coon.Open();int n = cmd.ExecuteNonQuery();// MessageBox.Show("您已经删除了" + n.ToString() + "条数据!");}string sql3 = "delete from Table_tree where NAME=N'" + t.Text + "';";// MessageBox.Show(sql3);using (SqlConnection coon = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql3, coon);coon.Open();int n = cmd.ExecuteNonQuery();// MessageBox.Show("您已经删除了" + n.ToString() + "条数据!"); }}else{string sql4 = "delete from Table_person where CATEGORY_NUMBER ="+ t.Tag + ";";string sql5 = "delete from Table_tree where NUMBER =" + t.Tag + ";";// MessageBox.Show(sql4);using (SqlConnection coon = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql4, coon);coon.Open();int n = cmd.ExecuteNonQuery();// MessageBox.Show("您已经删除了" + n.ToString() + "条数据!");SqlCommand cmd1 = new SqlCommand(sql5, coon);int n1 = cmd1.ExecuteNonQuery();// MessageBox.Show("您已经删除了" + n.ToString() + "条数据!");}}}Form_show ff = new Form_show();ff = (Form_show)this.Owner;ff.reshow();this.Close();}private void skinButton_giveup_Click(object sender, EventArgs e){this.Close();}}}5、添加界面(部门,班组)using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using CCWin;using System.Data.SqlClient;namespace实验__人事管理系统{public partial class Form_Add : CCSkinMain{public Form_Add(){InitializeComponent();}public Form_Add(TreeNode t1){this.t = t1;InitializeComponent();}int ID;TreeNode t = new TreeNode();string src = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=c:\users\博博\documents\visual studio 2013\Projects\实验——人事管理系统\实验——人事管理系统\MyData.mdf;Integrated Security=True";private void Form_Add_Load(object sender, EventArgs e){}private void skinButton_add_Click(object sender, EventArgs e){if (this.textBox_categoryname.Text != ""){string sql = ";";string sql1 = "select ID from Table_tree where ID=(select MAX(ID) from Table_tree);";using (SqlConnection conn = new SqlConnection(src)){SqlCommand cmd = new SqlCommand(sql1, conn);conn.Open();SqlDataReader dr = cmd.ExecuteReader();while (dr.Read()){ID = (int)dr["ID"];}// MessageBox.Show(ID.ToString());//MessageBox.Show("添加成功,数据库。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
矿产资源开发利用方案编写内容要求及审查大纲
矿产资源开发利用方案编写内容要求及《矿产资源开发利用方案》审查大纲一、概述
㈠矿区位置、隶属关系和企业性质。
如为改扩建矿山, 应说明矿山现状、
特点及存在的主要问题。
㈡编制依据
(1简述项目前期工作进展情况及与有关方面对项目的意向性协议情况。
(2 列出开发利用方案编制所依据的主要基础性资料的名称。
如经储量管理部门认定的矿区地质勘探报告、选矿试验报告、加工利用试验报告、工程地质初评资料、矿区水文资料和供水资料等。
对改、扩建矿山应有生产实际资料, 如矿山总平面现状图、矿床开拓系统图、采场现状图和主要采选设备清单等。
二、矿产品需求现状和预测
㈠该矿产在国内需求情况和市场供应情况
1、矿产品现状及加工利用趋向。
2、国内近、远期的需求量及主要销向预测。
㈡产品价格分析
1、国内矿产品价格现状。
2、矿产品价格稳定性及变化趋势。
三、矿产资源概况
㈠矿区总体概况
1、矿区总体规划情况。
2、矿区矿产资源概况。
3、该设计与矿区总体开发的关系。
㈡该设计项目的资源概况
1、矿床地质及构造特征。
2、矿床开采技术条件及水文地质条件。