学生信息管理系统源代码

时间:2019-05-14 09:47:19下载本文作者:会员上传
简介:写写帮文库小编为你整理了多篇相关的《学生信息管理系统源代码》,但愿对你工作学习有帮助,当然你在写写帮文库还可以找到更多《学生信息管理系统源代码》。

第一篇:学生信息管理系统源代码

学生信息管理系统源代码

import java.io.*;

class StuInfo {

public String name;

public int number;

public String sex;

public String age;

public String bir;

public String email;

public String addr;

public String tel;

public String getName(){

return name;

}

public void setName(String name){

this.name = name;

}

public int getNumber(){

return number;

}

public void setNumber(int number){

this.number = number;

}

public String getSex(){

return sex;

}

public void setSex(String sex){

this.sex = sex;

}

public String getAge(){

return age;

}

public void setAge(String age){

this.age = age;

}

public String getBir(){

return bir;

}

public void setBir(String bir){

this.bir = bir;

}

public String getEmail(){

return email;

} public void setEmail(String email){

this.email = email;} public String getAddr(){

return addr;} public void setAddr(String addr){

this.addr = addr;} public String getTel(){

return tel;} public void setTel(String tel){

this.tel = tel;} } public class Student { private static PrintStream out = System.out;private static String filename = “Stu.txt”;private static int total = 0;private static int rt = 0;//recyle length private StuInfo[] stuInfos;private StuInfo[] recycle;BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));//创建缓冲流

public Student(){

stuInfos = new StuInfo[11];

}

public void 信息录入(){

BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));

try{

System.out.print(“n请输入学生信息(以0结束)n”);

System.out.print(“学号:n”);

StuInfo stu = new StuInfo();

stu.setNumber(Integer.parseInt(buf.readLine()));

while(stu.getNumber()!=0){

System.out.print(“姓名:nn”);

stu.setName(buf.readLine());

System.out.print(“性别:nn”);

stu.setSex(buf.readLine());

System.out.print(“年龄:nn”);

stu.setAge(buf.readLine());

System.out.print(“生日:nn”);

stu.setBir(buf.readLine());

System.out.print(“邮箱:nn”);

stu.setEmail(buf.readLine());

System.out.print(“地址:nn”);

stu.setAddr(buf.readLine());

System.out.print(“电话:nn”);

stu.setTel(buf.readLine());

//添加其他输入信息

stuInfos[total]=stu;

total++;

stu = new StuInfo();

System.out.print(“n请输入下一个学生信息(以0结束)n”);

System.out.print(“姓名:n”);

stu.setName(buf.readLine());

}

}catch(Exception e){

out.print(e);

}

} public void 保存数据(){ try{

FileWriter fwr=new FileWriter(filename);

BufferedWriter fw = new BufferedWriter(fwr);

fw.write(total+“rn”);

for(int k=0;k

fw.write(stuInfos[k].getNumber()+“rn”);

fw.write(stuInfos[k].getName()+“rn”);

fw.write(stuInfos[k].getSex()+“rn”);

fw.write(stuInfos[k].getAge()+“rn”);

fw.write(stuInfos[k].getBir()+“rn”);

fw.write(stuInfos[k].getEmail()+“rn”);

fw.write(stuInfos[k].getAddr()+“rn”);

fw.write(stuInfos[k].getTel()+“rn”);

}

fw.write(rt+“rn”);

for(int k=0;k

fw.write(recycle[k].getNumber()+“rn”);

fw.write(recycle[k].getName()+“rn”);

fw.write(recycle[k].getSex()+“rn”);

} fw.write(recycle[k].getAge()+“rn”);fw.write(recycle[k].getBir()+“rn”);fw.write(recycle[k].getEmail()+“rn”);fw.write(recycle[k].getAddr()+“rn”);fw.write(recycle[k].getTel()+“rn”);

}

fw.flush();

fw.close();

fwr.close();

System.out.println(“n已保存数据!”);}catch(Exception e){ out.print(e);} public void 读取数据(){

try{

FileReader fr = new FileReader(filename);

BufferedReader bfr = new BufferedReader(fr);

String buff = bfr.readLine();

if(buff!= null){

total = Integer.parseInt(buff);

}else{

total = 0;

}

StuInfo stu;

for(int i=0;i

stu = new StuInfo();

stu.setNumber(Integer.parseInt(bfr.readLine()));

stu.setName(bfr.readLine());

stu.setSex(bfr.readLine());

stu.setAge(bfr.readLine());

stu.setBir(bfr.readLine());

stu.setEmail(bfr.readLine());

stu.setAddr(bfr.readLine());

stu.setTel(bfr.readLine());

stuInfos[i]=stu;

}

buff = bfr.readLine();

if(buff!= null){

rt = Integer.parseInt(buff);

}else{

rt = 0;

}

for(int i=0;i

stu = new StuInfo();stu.setNumber(Integer.parseInt(bfr.readLine()));stu.setName(bfr.readLine());stu.setSex(bfr.readLine());stu.setAge(bfr.readLine());stu.setBir(bfr.readLine());stu.setEmail(bfr.readLine());stu.setAddr(bfr.readLine());stu.setTel(bfr.readLine());

//补全

} recycle[i]=stu;

}

// bfr.flush();

bfr.close();

fr.close();

System.out.println(“读取成功”);}catch(Exception e){ out.print(e);} public void 显示学生(StuInfo[] stus,int length){ try{

out.println(“----------”);for(int i=0;i

out.println(“学号:”+stus[i].getNumber());

out.println(“姓名:”+stus[i].getName());

out.println(“性别:”+stus[i].getSex());

out.println(“年龄:”+stus[i].getAge());

out.println(“生日:”+stus[i].getBir());

out.println(“邮箱:”+stus[i].getEmail());

out.println(“地址:”+stus[i].getAddr());

out.println(“电话:”+stus[i].getTel());//输出其他内容.....out.println(“----------”);

}

System.out.println(“请按任意键继续”);

buf.read();//

} }catch(Exception e){ out.print(e);}

public void 姓名查询(String name){ StuInfo[] result = new StuInfo[11];int r = 0;for(int i=0;i

if(stuInfos[i].getName().equals(name)){

result[r]=stuInfos[i];

r++;

} } if(r==0){

System.out.print(“查找不到该学生!”);//提示找不到学生

return;}else{

显示学生(result, r);} } public void 学号查询(String number){ StuInfo[] result = new StuInfo[11];int r = 0;for(int i=0;i

if(Integer.toString(stuInfos[i].getNumber()).equals(number)){

result[r]=stuInfos[i];

r++;//补全

} } if(r==0){

System.out.print(“查找不到该学生!”);//提示找不到学生

}else{

显示学生(result, r);} } public void 查找菜单(){//全字匹配

int choice;try{

do{

System.out.println(“查找界面”);//

System.out.println(“1:按姓名查询”);

System.out.println(“2:按学号查询”);

System.out.println(“0:返回上级”);

BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));

choice = Integer.parseInt(buf.readLine());

switch(choice){

case 1:

System.out.println(“请输入姓名”);//获得输入的姓名

String name = buf.readLine();

姓名查询(name);break;case 2:

System.out.println(“请输入学号”);String number = buf.readLine();学号查询(number);//获得输入的学号

break;

default:

System.out.println(“对不起,出现异常!”);

//异常:7

}

}while(choice!=0);

}catch(Exception e){

out.print(e);

}

}

public boolean 修改学生(int number){

boolean flag = false;

try{

for(int i=0;i

if(stuInfos[i].getNumber()==number){

BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));

StuInfo stu = new StuInfo();

System.out.print(“n请输入学生信息n”);

System.out.print(“姓名:nn”);

stu.setName(buf.readLine());

System.out.print(“性别:nn”);

stu.setSex(buf.readLine());

System.out.print(“年龄:nn”);

stu.setAge(buf.readLine());

System.out.print(“生日:nn”);

stu.setBir(buf.readLine());

System.out.print(“邮箱:nn”);

stu.setEmail(buf.readLine());

break;

}

}

}catch(Exception e){

out.print(e);

}

return flag;}

System.out.print(“地址:nn”);stu.setAddr(buf.readLine());

System.out.print(“电话:nn”);stu.setTel(buf.readLine());stu.setNumber(number);stuInfos[i]=stu;

System.out.print(“修改完成啦!”);//提示修改完成

public boolean 删除学生(int number){ boolean flag = false;

} for(int i=0;i

if(rt==0){

recycle = new StuInfo[101];

}

recycle[rt]=stuInfos[i];

for(;i

stuInfos[i]=stuInfos[i+1];

}

total--;

flag=true;

break;} } return flag;

public

void 删除页面(){ System.out.print(“删除页面”);//请输入要删除的学号

try{

int choice;

BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));

System.out.println(“1:学生信息修改”);

System.out.println(“2:学生信息删除”);

System.out.println(“请输入您的选择(1--2)”);

//...choice = Integer.parseInt(buf.readLine());

switch(choice){

case 1:

System.out.println(“请输入要修改的学号:”);choice = Integer.parseInt(buf.readLine());

修改学生(choice);

break;case 2:

System.out.println(“请输入要删除的学号:”);choice = Integer.parseInt(buf.readLine());

删除学生(choice);break;//补充

} /*if(删除学生(choice)){

System.out.print(“删除成功!”);//删除成功

}else{

System.out.print(“删除失败!”);//删除失败

}*/ }catch(Exception e){ out.print(e);} } public void showMenu(){ try{

int choice;

do{

System.out.println(“学生管理系统主菜单界面”);

System.out.println(“1:学生信息录入”);

System.out.println(“2:学生信息浏览”);

System.out.println(“3:学生信息查询”);

System.out.println(“4:学生修改与删除”);

System.out.println(“5:学生信息保存”);

System.out.println(“6:学生信息读取”);

System.out.println(“0:退出系统”);

System.out.println(“请输入您的选择(0--6)”);

BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));

choice = Integer.parseInt(buf.readLine());

switch(choice){

case 1:

信息录入();//

break;

case 2:

//补全方法调用

显示学生(stuInfos, total);

break;

case 3:

查找菜单();

break;

case 4:

删除页面();

break;

case 5:

保存数据();

break;

case 6:

读取数据();

break;

default:

System.out.print(“出现异常!”);

}

}while(choice!=0);

}catch(Exception e){

System.out.println(e);

}

// TODO 自动生成的方法存根

}

public static void main(String[] args){

Student student = new Student();

student.showMenu();

} }

//异常:7

第二篇:职工信息管理系统源代码

#include #include #include int N=2;struct worker/*定义一个职工信息的结构体*/ {

intnum;

/*定义一个职工信息的结构体*/ char name[20];

/*定义一个职工信息的结构体*/

char sex[10];

//用字符串存放职工的性别数据

char birth[20];//用字符串存放职工的出生年月数据

char deta[20];//用字符串存放职工的工作年月数据

char education[20];//用字符串存放职工的学历数据

double salary;

//用字符串存放职工的性别数据

char work[30];//用字符串存放职工的职务数据

char addr[20];//用字符串存放职工的地址数据

char tel[20];//用字符串存放职工的电话数据 }worker[100];//用结构体数组存放职工的所有信息 void menu();

void input();

void save();

void read();

void display();

void add();

void search();

voidsearch_education();

voidsearch_num();

void del();

void modify();

void main()

{ char s;

system(“color 3f”);

printf(“nn”);

printf(“ t┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓n”);

printf(“ t┃**********************************************************┃n”);

printf(“ t┃***┏━━━━━━━━━━━━━━━━━━━━━━━━┓***┃n”);

printf(“ t┃***┃************************************************┃***┃n”);

printf(“ t┃***┃***

****┃***┃n”);

printf(“ t┃***┃***

欢迎使用职工信息管理系统

****┃***┃n”);

printf(“ t┃***┃***

****┃***┃n”);

printf(“ t┃***┃***

****┃***┃n”);

printf(“ t┃***┃***

制作人吴青伶

****┃***┃n”);

printf(“ t┃***┃***

****┃***┃n”);

printf(“ t┃***┃***

2013.12.28

****┃***┃n”);

printf(“ t┃***┃***

****┃***┃n”);

printf(“ t┃***┃************************************************┃***┃n”);

printf(“ t┃***┗━━━━━━━━━━━━━━━━━━━━━━━━┛***┃n”);

printf(“ t┃**********************************************************┃n”);printf(“ t┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛n”);do { menu();printf(“Do you want to continue?(y/n)”);

s=getchar();}while(s=='Y'||s=='y');} void menu()/*菜单函数*/ { int b;printf(“t

n”);printf(“t

n”);printf(“t

n”);printf(“t

n”);printf(“t

n”);printf(“t

请选择

n”);printf(“t

------------------------------n”);printf(“t

||

||

n”);printf(“t

||

1.职工信息录入

||

n”);printf(“t

||

2.职工信息浏览

||

n”);printf(“t

||

3.职工信息添加

||

n”);printf(“t

||

4.职工信息查询

||

n”);printf(“t

||

5.职工信息删除

||

n”);printf(“t

||

6.职工信息修改

||

n”);printf(“t

||

0.退出

||

n”);printf(“tn”);printf(“n 输入你的选择项(0~6):n”);

scanf(“%d”,&b);

switch(b)

{

case 1 : //职工信息录入、保存

input();

save();

getchar();

break;

case 2 ://读入职工信息并显示

read();

display();

getchar();break;

case 3 : //添加职工信息

add();getchar();break;

case 4 : //查询职工信息

search();getchar();break;

case 5 : //读入职工信息并实现职工信息删除功能

read();

del();

getchar();

break;

case 6 : //读入职工信息并修改职工信息

read();modify();getchar();break;

case 0 : exit(0);//退出

default:break;} } void input()

//录入职工信息 {

inti,flag,j;printf(“输入职工个数(默认个数为2):”);scanf(“%d”,&N);fflush(stdin);//清除缓存 for(i=0;i

{ loop: printf(“职工号:”);scanf(“%d”,&worker[i].num);fflush(stdin);flag=1;if(worker[N].num<0)

printf(“请输入正整数:n”);else for(j=0;j

{

if(worker[i].num==worker[j].num)

{

flag=0;

printf(“ 工号重复,请重新输入!n”);

goto loop;

}

} printf(“姓名:”);scanf(“%s”,worker[i].name);fflush(stdin);printf(“性别:”);scanf(“ %s”,worker[i].sex);fflush(stdin);printf(“出生年月:”);scanf(“%d”,&worker[i].birth);fflush(stdin);printf(“工作年月:”);scanf(“%lf”,&worker[i].deta);fflush(stdin);printf(“请输入学历(中专=zz,大专=dz,本科=bk,研究生=yjs):n”);scanf(“%s”,worker[i].education);fflush(stdin);printf(“工资:”);scanf(“%lf”,worker[i].salary);fflush(stdin);printf(“职务:”);scanf(“%s”,worker[i].work);fflush(stdin);printf(“住址:”);scanf(“%s”,worker[i].addr);fflush(stdin);printf(“电话:”);scanf(“%s”,worker[i].tel);fflush(stdin);

} printf(“n创建完毕!n”);}

void save()

//保存函数 {

FILE *fp;int i;

if((fp=fopen(“worker.txt”,“wb”))==NULL)//以只写方式打开一个二进制文件

{

printf(“ncannot open filen”);

exit(0);} for(i=0;i

void read()

//读入函数 {

FILE *fp;int i=0;

if((fp=fopen(“worker.txt”,“rb”))==NULL)//以只读方式为输出打开磁盘文件中的一个二进制文件

{

printf(“ncannot open filen”);

exit(0);} do{ fread(&worker[i],sizeof(struct worker),1,fp);//从worker.txt文件向内存读入数据(二进制)

i++;}while(!feof(fp));fclose(fp);

N=i-1;}

void display()

//信息浏览函数 {

int i;for(i=0;i

{ printf(“职工号:%dn”,worker[i].num);printf(“姓名:%sn”,worker[i].name);printf(“性别:%sn”,worker[i].sex);printf(“出生年月:%dn”,worker[i].birth);printf(“工作年月:%dn”,worker[i].deta);printf(“学历:%sn”,worker[i].education);printf(“工资:%lfn”,worker[i].salary);printf(“职务:%dn”,worker[i].work);printf(“住址:%sn”,worker[i].addr);printf(“电话:%sn”,worker[i].tel);

} } void add()

//添加函数 { FILE *fp;int i;struct worker p;double t;printf(“n请输入新增加职工的信息:n”);

printf(“请输入职工号:n”);

scanf(“%d”,&p.num);

for(i=0;i

{

while(worker[i].num==p.num)

{

printf(“ 工号重复,请重新输入!n”);

scanf(“%d”,&p.num);

}

} printf(“请输入姓名:n”);scanf(“%s”,p.name);printf(“请输入性别:n”);scanf(“%s”,p.sex);printf(“请输入出生年月:n”);scanf(“%d”,&p.birth);printf(“请输入工作年月:n”);scanf(“%d”,&p.deta);printf(“请输入学历(中专=zz,大专=dz,本科=bk,=yjs:):n”);scanf(“%s”,p.education);printf(“请输入工资:n”);scanf(“%lf”,&t);p.salary=t;printf(“请输入职务:n”);scanf(“%s”,p.work);printf(“请输入住址:n”);scanf(“%s”,p.addr);printf(“请输入电话:n”);scanf(“%s”,p.tel);printf(“n添加完毕!n”);

if((fp=fopen(“worker.txt”,“ab”))==NULL)//以追加方式打开一个二进制文件尾部

{ printf(“ncannot open filen”);exit(0);

} fwrite(&p,sizeof(struct worker),1,fp);fclose(fp);} void search()

//查询函数 {

int c;do {

puts(“nsearch by=>n1.学历2.职工号3.取消并返回”);printf(“Which you needed?:n”);scanf(“%d”,&c);

研究生if(c>3||c<1)

{

puts(“nchoiceerror!please again!”);getchar();//此语句用于接受在执行上一句时最后输出的回车符

}

} while(c>3||c<1);

{ switch(c)

{ case 1:search_education();break;case 2:search_num();break;case 3:menu();break;

}

} } void search_education()

//按学历查询函数 { inti,flag=0;char s[10];printf(“n请输入你要查询的学历:n”);scanf(“%s”,s);for(i=0;i

{ if(strcmp(s,worker[i].education)==0)

{

printf(“职工号:%dn”,worker[i].num);

printf(“姓名:%sn”,worker[i].name);

printf(“性别:%sn”,worker[i].sex);

printf(“出生年月:%dn”,worker[i].birth);

printf(“工作年月:%dn”,worker[i].deta);

printf(“学历(中专=zz,大专=dz,yjs):%sn”,worker[i].education);printf(“工资:%lfn”,worker[i].salary);printf(“职务:%lfn”,worker[i].work);

printf(“住址:%sn”,worker[i].addr);

printf(“电话:%sn”,worker[i].tel);flag++;

}

} if(flag==0)

printf(“n对不起没有找到!n”);getchar();} void search_num()

//按工号查询函数 { inti,s,flag=0;printf(“n输入要查询的职工号!:n”);scanf(“%d”,&s);

本科=bk,研究生=for(i=0;i

{

if(s==worker[i].num)

{

printf(“职工号:%dn”,worker[i].num);

printf(“姓名:%sn”,worker[i].name);

printf(“性别:%sn”,worker[i].sex);

printf(“出生年月:%dn”,worker[i].birth);

printf(“工作年月:%dn”,worker[i].deta);

printf(“学历(中专=zz,大专=dz,本科=bk,研究生=yjs):%sn”,worker[i].education);

printf(“工资:%lfn”,worker[i].salary);printf(“职务:%lfn”,worker[i].work);

printf(“住址:%sn”,worker[i].addr);

printf(“电话:%sn”,worker[i].tel);

flag++;

}

}

if(flag==0)printf(“n对不起没有找到!please”);

getchar();}

void del()

//删除函数 { inti,j;FILE *fp;char name[20];char c;if((fp=fopen(“worker.txt”,“wb”))==NULL)//以只写方式打开一个二进制文件

{

printf(“ncannot open filen”);exit(0);

} printf(“请输入要删除的职工的姓名:”);scanf(“%s”,name);for(i=0;i

if(strcmp(name,worker[i].name)==0)//判断输入的姓名和原来的姓名是否相同

{

printf(“找到该职工,是否删除?(y/n)”);

fflush(stdin);

scanf(“%c”,&c);

if(c =='Y'||c=='y')

{

for(j=i;j

worker[j]=worker[j+1];

printf(“删除成功!n”);

//break;

}

} } if(i>=N){ printf(“没有找到该职工!n ”);

return;}

else {

N=N-1;

for(i=0;i

if(fwrite(&worker[i],sizeof(struct worker),1,fp)!=1)

{

printf(“ncannot save filen”);getchar();

}

fclose(fp);}

}

void modify()

//修改函数 { struct worker p;FILE *fp;inti,n;double t;printf(“n输入要修改的职工号:n”);scanf(“%d”,&n);

for(i=0;i

if(n==worker[i].num)

{

printf(“找到该职工的信息(任意键继续)!”);

printf(“n请输入职工的信息!n”);

printf(“请输入姓名:n”);scanf(“%s”,p.name);

printf(“请输入性别:n”);scanf(“%s”,p.sex);

printf(“请输入出身年月:n”);scanf(“%d”,&p.birth);printf(“请输入工作年月:n”);scanf(“%lf”,&p.deta);

printf(“请输入学历(中专=zz,大专=dz,yjs):n”);scanf(“%s”,p.education);printf(“请输入工资:n”);scanf(“%lf”,&t);

p.salary=t;printf(“请输入职务:n”);scanf(“%s”,p.work);

printf(“请输入住址:n”);scanf(“%s”,p.addr);

本科=bk,研究生=

}

printf(“请输入电话:n”);scanf(“%s”,p.tel);p.num=n;

if((fp=fopen(“worker.txt”,“r+”))==NULL)//以读写的方式将修改的信息写入磁盘文件

{

printf(“ncannot open filen”);

exit(0);

}

fseek(fp,i*sizeof(struct worker),0);//将位置指针移到i*sizeof(struct worker)个字节处

fwrite(&p,sizeof(struct worker),1,fp);

fclose(fp);

printf(“修改成功!n”);

break;} } if(i>=N)printf(“n未找到该职工!n”);

第三篇:VB学生信息管理系统及源代码

VB学生信息管理系统及源代码

Option Explicit

'标识是否能关闭

Dim mbClose As Boolean

'标识当前要显示的照片的文件 Dim mstrFileName As String Private Sub Form_Load()

On Error Resume Next

If frmMain.mnUserType = 1 Then

'学生用户

fraSeek.Enabled = False

fraBrowse.Enabled = False

cmdAdd.Enabled = False

cmdDelete.Enabled = False

txtSerial.Enabled = False

dcbClass.Enabled = False

grdScan.Enabled = False

If Not(DataEnv.rsStudent.EOF And DataEnv.rsStudent.BOF)Then

Dim Temp As String

Temp = “name = ” & “'” & frmMain.msUserName & “'”

DataEnv.rsStudent.MoveFirst

DataEnv.rsStudent.Find Temp

'刷新所绑定的控件

Call RefreshBinding

End If

Exit Sub

Else

fraSeek.Enabled = True

fraBrowse.Enabled = True

cmdAdd.Enabled = True

cmdDelete.Enabled = True

txtSerial.Enabled = True

dcbClass.Enabled = True

grdScan.Enabled = True

End If

Dim rsDep As New ADODB.Recordset, rsClass As New ADODB.Recordset

Set rsDep = DataEnv.rsDepartment

Set rsClass = DataEnv.rsClass

rsDep.Open

'从Department表中读取数据,填充cboDep组合框到中

cboDep.Clear

cboDep.AddItem “全部”

'将各个系的id号作为ItemData附加到组合框中

cboDep.ItemData(0)= 0

While Not rsDep.EOF

cboDep.AddItem rsDep(“Name”)

cboDep.ItemData(cboDep.ListCount1)

ChunkAry = blobColumn.GetChunk(Fragment)

Put FileNumber, , ChunkAry

'写入文件

End If

ReDim ChunkAry(ChunkSize-1)

'为数据块重新开辟空间

For lngI = 1 To Chunks

'循环读出所有块

ChunkAry = blobColumn.GetChunk(ChunkSize)

'在数据库中连续读数据块

Put FileNumber, , ChunkAry()

'将数据块写入文件中

Next lngI

Close FileNumber

ReadImage = strFileName

Exit Function

errHander:

ReadImage = “" End Function

Private Sub imgPhoto_Click()End

'关闭文件 Sub

Option Explicit '表示当前的用户类型:0---管理员类型的用户;1---学生类型的用户 Public mnUserType As Integer '表示当前登录的用户名 Public msUserName As String

Private Sub MDIForm_Load()

'根据不同的用户类型,使相应的菜单项可见

Select Case mnUserType

Case 0:

'以管理员身份登录

mnuFind.Visible = True

tlbMain.Buttons.Item(3).Visible = True

tlbMain.Buttons.Item(4).Visible = True

Exit Sub

Case 1:

'以学生身份登录,只能查询自己的信息

mnuFind.Visible = False

'“信息查询”菜单不可见

tlbMain.Buttons.Item(3).Visible = False

'“信息查询”按钮不可见

tlbMain.Buttons.Item(4).Visible = False

'第二个分隔条不可见

Exit Sub

End Select End Sub

Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)

If MsgBox(”真的要对出本系统吗?“, vbQuestion + vbYesNo + vbDefaultButton2, ”退出“)= vbNo Then

Cancel = 1

End If End Sub Private Sub mnuAbout_Click()

Load frmSplash

frmSplash.mbAbout = True

frmSplash.Show vbModal End Sub

Private Sub mnuArr_Click()

frmMain.Arrange(3)

'设置主窗体中所有最小化MDI子窗体图标重排 End Sub

Private Sub mnuCas_Click()

frmMain.Arrange(0)

'设置主窗体中所有非最小化MDI子窗体层叠显示 End Sub

Private Sub mnuExit_Click()

Unload Me End Sub

Private Sub mnuFind_Click()

frmFind.Show End Sub

Private Sub mnuHori_Click()

frmMain.Arrange(1)

'设置主窗体中所有非最小化MDI子窗体水平平铺 End Sub

Private Sub mnuLog_Click()

If MsgBox(”若重新登录,所有窗体都将关闭!“ & vbCrLf & ”

是否重新登录?“, _

vbQuestion + vbYesNo + vbDefaultButton2, ”重新登录“)= vbYes Then

Unload Me

frmLogin.Show

End If End Sub

Private Sub mnuStudent_Click()

Load frmStudent

frmStudent.Show End Sub Private Sub mnuVer_Click()

frmMain.Arrange(2)

'设置主窗体中所有非最小化MDI子窗体垂直平铺 End Sub

Private Sub tlbMain_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key

Case ”Student“

mnuStudent_Click

Exit Sub

Case ”Find“

mnuFind_Click

Exit Sub

Case ”Login“

mnuLog_Click

Exit Sub

Case ”Exit“

mnuExit_Click

Exit Sub

End Select End SubOption Explicit

'表示当前用户登录所选择的身份,即用户类型, 0-表示教务管理人员;1-表示学生 Dim mnUserType As Integer Private Sub cmdCancel_Click()

Unload Me End Sub

Private Sub cmdOK_Click()

'取得用户输入的用户名和密码

Dim user As String, pwd As String

user = Trim(txtUser)

pwd = Trim(txtPwd)

'根据不同的身份,选择不同的表用以查询

Dim r As New ADODB.Recordset

Set r = DataEnv.rssqlSeek

Dim strSQL As String

Select Case mnUserType

Case 0: '若身份为管理员

strSQL = ”select * from 系统人员表 where name='“ & user & ”' and pwd='“ & pwd & ”'“

Case 1: '若身份为学生

strSQL = ”select * from 学生信息表 where name='“ & user & ”' and serial='“ & pwd & ”'“

End Select

On Error Resume Next

'查询DataEnv.rssqlSeek的状态,如果已经打开,则先关闭

If r.State = adStateOpen Then r.Close

r.Open strSQL

'根据strSQL的内容刷新DataEnv.rssqlSeek

'用户密码错误的次数,如果错误次数超过3次,则退出系统

Static nTryCount As Integer

If r.EOF Then

'登录失败

MsgBox ”对不起,无此用户或者密码不正确!请重新输入!“, vbCritical, ”错误“

txtUser.SetFocus

txtUser.SelStart = 0

txtUser.SelLength = Len(txtUser)

nTryCount = nTryCount + 1

If nTryCount >= 3 Then

MsgBox ”您无权操作本系统!“, vbCritical, ”错误“

Unload Me

End If

Else

'登陆成功

'显示MDI窗体, 并将用户类型和用户名传到MDI窗体中的mnUserType, msUserName中

With frmMain

.mnUserType = mnUserType

.msUserName = user

End With

Load frmMain

frmMain.Show

Unload Me

End If End Sub Private Sub Form_Load()

optUserType(0).Value = True End Sub

Private Sub optUserType_Click(Index As Integer)

mnUserType = Index End Sub Explicit

Private Sub Command1_Click()

Dim strCon1 As String

Dim strCon2 As String

On Error GoTo myerr

If Trim(Text1.Text)= ”“ Or Trim(Text2.Text)= ”“ Then

If MsgBox(”请输入查询条件!“, vbInformation, ”提示“)Then GoTo myerr

End If

Select Case Trim(Combo1.Text)

Case ”学号“

strCon1 = ”Serial“

Case ”姓名“

strCon1 = ”Name“

Case ”班级“

strCon1 = ”Class“

Option

Case ”生日“

strCon1 = ”Birthday“

Case ”性别“

strCon1 = ”Sex“

Case ”家庭地址“

strCon1 = ”Address“

Case ”电话“

strCon1 = ”Tel“

End Select

Select Case Trim(Combo4.Text)

Case ”学号“

strCon2 = ”Serial“

Case ”姓名“

strCon2 = ”Name“

Case ”班级“

strCon2 = ”Class“

Case ”生日“

strCon2 = ”Birthday“

Case ”性别“

strCon2 = ”Sex“

Case ”家庭地址“

strCon1 = ”Address“

Case ”电话“

strCon2 = ”Tel“

End Select

DataEnv.rsStudent.Close

DataEnv.rsStudent.Open ”select * from 学生信息表

where “ & _

strCon1 & Trim(Combo2.Text)& ” '“ & Trim(Text1.Text)_

& ”'“ & ” “ & Trim(Combo3.Text)& ” “ & strCon2 & _

Trim(Combo5.Text)& ”'“ & Trim(Text2.Text)& ”'“

dgdCX.DataMember = ”“

dgdCX.Refresh

DataEnv.rsStudent.Requery

dgdCX.DataMember = ”Student“

dgdCX.Refresh myerr: End Sub

Private Sub Command3_Click()

Unload Me End Sub

Private Sub dgdCX_Click()

End Sub

Private Sub Form_Load()

'添加Combo1的子项作为查询标准

Combo1.AddItem(”学号“)

Combo1.AddItem(”姓名“)

Combo1.AddItem(”班级“)

Combo1.AddItem(”生日“)

Combo1.AddItem(”性别“)

Combo1.AddItem(”家庭地址“)

Combo1.AddItem(”电话“)

Combo1.ListIndex = 0

'添加Combo2的子项作为关系符

Combo2.AddItem(”=“)

Combo2.AddItem(”>“)

Combo2.AddItem(”>=“)

Combo2.AddItem(”<“)

Combo2.AddItem(”<=“)

Combo2.AddItem(”<>“)

Combo2.ListIndex = 0

'添加Combo3的子项作为逻辑连接符

Combo3.AddItem(”And“)

Combo3.AddItem(”Or“)

Combo3.ListIndex = 0

'添加Combo4的子项作为第二种查询标准

Combo4.AddItem(”学号“)

Combo4.AddItem(”姓名“)

Combo4.AddItem(”班级“)

Combo4.AddItem(”生日“)

Combo4.AddItem(”性别“)

Combo4.AddItem(”家庭地址“)

Combo4.AddItem(”电话“)

Combo4.ListIndex = 0

'添加Combo5的子项作为第二种关系符

Combo5.AddItem(”=“)

Combo5.AddItem(”>“)

Combo5.AddItem(”>=“)

Combo5.AddItem(”<“)

Combo5.AddItem(”<=“)

Combo5.AddItem(”<>")

Combo5.ListIndex = 0 End Sub

Private Sub Form_Unload(Cancel As Integer)

frmMain.Enabled = True

frmMain.Show End Sub

第四篇:C++课程设计 教职工信息管理系统源代码

教职工信息管理系统源码

#include #include #include #include

#define maxsize 100 fstream 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

cout<

void People::Displaypart(char p[])//引用数组

{

int i,c;

for(i=0;i

if(strcmp(data[i].wage,p)==0)

{

cout<<“输出选择姓名1 性别2 编号3 工资4 出生日期5 工作时间6 年龄7 系别8 退出选择9”<

while(cin>>c)

{

switch(c)

{

case 1: cout<<“姓名:”<

case 2: cout<<“性别:”<

case 3: cout<<“编号:”<

case 4: cout<<“工资:”<

case 5: cout<<“出生日期:”<

case 6: cout<<“工作时间:”<

case 7: cout<<“年龄:”<

case 8: cout<<“系别:”<

case 9: goto loop;

default:cout<<“操作错误......”<

}

}

loop:;

} }

void People::Findname(char n[])//引用 {

int i;

for(i=0;i

if(strcmp(data[i].name,n)==0)//对象引用

cout<

void People::Findyear(int y){

int i;

for(i=0;i

if(data[i].year==y)

cout<

void People::Del(int i){

int j;

if(i<1||i>length)

cout<<“不存在第”<

for(j=i;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<<“添加人员信息成功......”<

loop:

if(1==flag)

cout<<“人员信息储存空间已满......”<

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<<“添加人员信息成功......”<

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

cout<<“contine(Y|N)?”;

cin>>ans;

}while('y'==ans||'Y'==ans);loop:

if(1==flag)

cout<<“人员信息储存空间已满......”<

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<<“添加人员信息成功......”<

length++;

loop:

if(1==flag)

cout<<“人员信息储存空间已满......”<

iofile.close();}

void worker::Display(){

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆工人信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

if(0==length)

cout<<“无......”<

int i;

for(i=0;i

cout<

int i,j,k;

for(i=0;i

if(strcmp(data[i].name,n)==0){

k=i+1;break;}

if(k<1)

cout<<“不存在姓名”<

for(j=k;j

data[j-1]=data[j];

length--;

cout<<“删除人员信息成功......”<

void worker::Del(int i){

int j;

if(i<1||i>length)

cout<<“不存在第”<

for(j=i;j

data[j-1]=data[j];

length--;

cout<<“删除成功......”<

}

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]));

else

break;

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

}

People::Del(length);

cout<<“添加人员信息成功......”<

if(1==flag)

cout<<“人员信息储存空间已满......”<

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<<“添加人员信息成功......”<

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

cout<<“contine(Y|N)?”;

cin>>ans;

}while('y'==ans||'Y'==ans);loop:

if(1==flag)

cout<<“人员信息储存空间已满......”<

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<<“添加人员信息成功......”<

length++;loop:

if(1==flag)

cout<<“人员信息储存空间已满......”<

iofile.close();}

void Teacher::Display(){

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆教师信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

if(0==length)

cout<<“无......”<

int i;

for(i=0;i

cout<

void Teacher::Del(char n[]){

int i,j,k;

for(i=0;i

if(strcmp(data[i].name,n)==0)

{

k=i+1;break;

}

if(k<1)cout<<“不存在姓名”<

for(j=k;j

data[j-1]=data[j];

length--;

cout<<“删除人员信息成功......”<

void Teacher::Del(int i){

int j;

if(i<1||i>length)

cout<<“不存在第”<

for(j=i;j

data[j-1]=data[j];

length--;

cout<<“删除成功......”<

istream& operator>>(istream& input,Telem& T){

int y,m,d;

cout<<“请输入姓名(以*结尾):”<

input.getline(T.name,20,'*');

cout<<“请输入性别(以*结尾 男或女):”<

input.getline(T.sex,10,'*');

cout<<“编号(以*结尾):”<

input.getline(T.num,20,'*');

cout<<“工资(以*结尾):”<

input.getline(T.wage,20,'*');

cout<<“请输入出生日期:”<

input>>y>>m>>d;

T.birthtime.year=(y>=1900&&y<=2100)?y:1900;

T.birthtime.month=(m>=1&&m<=12)?m:1;

T.birthtime.day=(d>=1&&d<=31)?d:1;

cout<<“请输入系别(以*结尾):”<

input.getline(T.department,20,'*');

cout<<“参加工作时间:”<

input>>y>>m>>d;

T.worktime.year=(y>=1900&&y<=2100)?y:1900;

T.worktime.month=(m>=1&&m<=12)?m:1;

T.worktime.day=(d>=1&&d<=31)?d:1;

return input;}

ostream& operator<<(ostream& output,Telem& T){

cout<<“姓名:”;

output<

cout<<“性别:”;

output<

cout<<“编号:”;

output<

cout<<“工资:”;

output<

cout<<“出生日期:”;

output<

cout<<“系别:”;

output<

cout<<“参加工作时间:”;

output<

cout<<“年龄:”;

output<

return output;}

int operator-(Time & t1,Time & t2){

return t1.year-t2.year;}

void Showmenu(){

cout<

cout<<“

欢 迎 进 入 教 职 工 信 息 管 理 系 统”<

cout<<“

2010 年7月7日发布”<<“

版权所有: swa”<

cout<<“

★ ☆ ★ ☆ ★ ☆ ★ ☆ ★人员信息管理系统★ ☆ ★ ☆ ★ ☆ ★ ☆ ★”<

cout<<“

1-从键盘录入全部人员记录

☆ ”<

cout<<“

☆ 2-增加一位人员记录

★”<

cout<<“

3-显示全部人员记录

☆”<

cout<<“

☆ 4-按系别输出人员信息(可选)★ ”<

cout<<“

5-按姓名或年龄检索所有信息☆ ”<

cout<<“

☆ 6-显示菜单目录

★ ”<

cout<<“

7-结束程序运行

☆ ”<

cout<<“

★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

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<<“ ★ ☆ ★ ☆ ★ ☆ ★录入全部人员记录 ★ ☆ ★ ☆ ★ ☆ ★”<

cout<<“ ★ ☆ ★ ☆ ★从键盘输入教师信息 ☆ ★ ☆ ★ ☆”<

pt->Addall();

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆从键盘输入工人信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

ps->Addall();

break;

}

case 2:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆从键盘增加一位人员记录 ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆教师操作请按1 工人操作请按2 ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

cin>>k;

if(1==k)

pt->Add();

else if(2==k)

ps->Add();

else

cout<<“操作错误...”<

break;

}

case 3:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆显示全部人员记录 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

pt->Display();

ps->Display();

break;

}

case 4:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆按部门输出人员信息(可选)★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

cout<<“ ★ ☆ ★ ☆ ★ ☆教师操作请按1 工人操作请按2 ★ ☆ ★ ☆ ★ ☆”<

cin>>k;

if(1==k)

{

cout<<“请输入要输出人员的系别(以*结尾):”<

pt->Displaypart(part);

}

else if(2==k)

{

cout<<“请输入要输出人员的系别(以*结尾):”<

ps->Displaypart(part);

}

else

cout<<“操作错误......”<

break;

}

case 5:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★按姓名或年龄检索所有信息 ★ ☆ ★ ☆ ★ ☆ ★”<

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★按姓名查找1 按年龄查找2 ★ ☆ ★ ☆ ★ ☆ ★”<

cin>>k;

if(1==k)

{

cout<<“按姓名查找1 按年龄查找2”<>l;

if(1==l)

{

cout<<“请输入要查找人员的姓名(以*结尾):”<

pt->Findname(nam);

}

else if(2==l)

{

cout<<“请输入要查找人的年龄:”<>i;

pt->Findyear(i);

}

else

cout<<“操作错误......”<

}

else if(2==k)

{

cout<<“按姓名查找1 按年龄查找2”<>l;

if(1==l)

{

cout<<“请输入要查找人员的姓名(以*结尾):”<

ps->Findname(nam);

}

else if(2==l)

{

cout<<“请输入要查找人的年龄:”<>i;

ps->Findyear(i);

}

else

cout<<“操作错误......”<

}

else

cout<<“操作错误......”<

break;

}

case 6:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆显示菜单目录 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

Showmenu();

break;

}

case 7:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆结束程序运行 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

exit(0);

}

default:cout<<“操作错误......”<

}

}

return 0;}

第五篇:C++大作业_职工信息管理系统源代码

#include #include #include using namespace std;

const N=5000;// 定义系统可录入的职工最大数值

string Ename[N];long Enum[N];char Esex[N];int Eage[N];

char Emarriage[N];int Edepart[N];int Eposition[N];int Edegree[N];int Eworktime[N];float Epay[N];

class Employee {

public:

string Employeename;

long Employeenum;

char Employeesex;

int Employeeage;

char Employeemarriage;

int Employeedepart;

int Employeeposition;

int Employeedegree;

int Employeeworktime;

float Employeepay;

static long EmployeeMaxNum;

static float EmployeeBasePay;

void NewInfo();

void ShowInfo();

void showall();

void showdepart(int depart);

void showdegree(int degree);

void showage(int min,int max);

void shownum(long number);

void RefreshInfo();

void DeleteInfo();

float Pay(int Employeegrade);

static int MaxNum();};

class DBOperate {

public:

string Employeename;

long Employeenum;

char Employeesex;

int Employeeage;

char Employeemarriage;

int Employeedepart;

int Employeeposition;

int Employeedegree;

int Employeeworktime;

float Employeepay;

static long EmployeeMaxNum;

static float EmployeeBasePay;

void WriteIn(int iflag);

void ReadOut();

void RefreshMaxNum(int iflag);//iflg=1 or-1 or 0 };

long Employee::EmployeeMaxNum = 1000;float Employee::EmployeeBasePay = 1500;

int Employee::MaxNum()//返回系统已经存储的人数

{

int MN = 0;

ifstream myf;

myf.open(“EmployeeMaxNum.txt”);

myf>>MN;

cout<

myf.close();

return MN;}

void Employee::NewInfo()//添加新职工函数

{

cout<<“新职工姓名: ”;

cin>>Employee::Employeename;

Employee::Employeenum = EmployeeMaxNum + Employee::MaxNum()+1;

cout<<“新职工性别(F为女性,M为男性): ”;

cin>>Employee::Employeesex;

cout<<“新职工年龄: ”;

cin>>Employee::Employeeage;

cout<<“新职工婚姻状况(Y为已婚,N为未婚): ”;

cin>>Employee::Employeemarriage;

cout<<“新职工学历,请输入相应学历的序号: ”<

cout<<“ [1:小学 2:初中 3:高中 4:本科 5:硕士 6:博士] ”;

cin>>Employee::Employeedegree;

while(Employee::Employeedegree!=1&&Employee::Employeedegree!=2&&Employee::Employeedegree!=3&&Employee::Employeedegree!=4&&Employee::Employeedegree!=5&&Employee::Employeedegree!=6)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:小学 2:初中 3:高中 4:本科 5:硕士 6:博士] ”;

cin>>Employee::Employeedegree;

}

cout<<“新职工所在部门,请输入相应部门的序号:”<

cout<<“ [1:董事会 2:销售部 3:人事部 4:客服中心 5:财务部 6:技术研发部 7:安全监察部] ”;

cin>>Employee::Employeedepart;

while(Employee::Employeedepart!=1&&Employee::Employeedepart!=2&&Employee::Employeedepart!=3&&Employee::Employeedepart!=4&&Employee::Employeedepart!=5&&Employee::Employeedepart!=6&&Employee::Employeedepart!=7)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:董事会 2:销售部 3:人事部 4:客服中心 5:财务部 6:技术研发部 7:安全监察部] ”;

cin>>Employee::Employeedepart;

}

cout<<“新职工职位, 请输入相应职位的序号: ”<

cout<<“ [1:临时职工 2: 正式职工 3:部门经理 4:主任 5:董事长] ”;

cin>>Employee::Employeeposition;

while(Employee::Employeeposition!=1&&Employee::Employeeposition!=2&&Employee::Employeeposition!=3&&Employee::Employeeposition!=4&&Employee::Employeeposition!=5)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:临时职员 2: 正式职员 3:部门经理 4:主任 5:董事长] ”;

cin>>Employee::Employeeposition;

}

cout<<“新职工的工作时长(不需要输入单位): ”;

cin>>Employee::Employeeworktime;

Employee::Employeepay = Employee::Pay(Employee::Employeeposition);

DBOperate dbo;

dbo.ReadOut();

int MaxNum = Employee::MaxNum();

Enum[MaxNum] = Employee::Employeenum;

Ename[MaxNum] = Employee::Employeename;

Esex[MaxNum] = Employee::Employeesex;

Eage[MaxNum] = Employee::Employeeage;

Emarriage[MaxNum] = Employee::Employeemarriage;

Edegree[MaxNum] = Employee::Employeedegree;

Edepart[MaxNum] = Employee::Employeedepart;

Eposition[MaxNum] = Employee::Employeeposition;

Eworktime[MaxNum] = Employee::Employeeworktime;

Epay[MaxNum] = Employee::Employeepay;

dbo.WriteIn(1);

cout<<“ 添加新成员成功!”<

void Employee::ShowInfo()//程序主体 数据输出函数

{

int choice1,choice2,min,max;

long searchnum;

Employee e;

cout<<“*******************************************”<

cout<<“-----------1.输出全体职工信息--------------”<

cout<<“-----------2.按职工部门输出----------------”<

cout<<“-----------3.按职工学历输出----------------”<

cout<<“-----------4.按职工年龄输出----------------”<

cout<<“-----------5.按职工编号输出----------------”<

cout<<“*******************************************”<

cout<<“ 请选择查询方式:”;

cin>>choice1;

switch(choice1)

{

case 1: showall();break;

case 2: cout<<“请输入要查询职工的部门编号[1:董事会 2:销售部 3:人事部 4:客服中心 5:财务部 6:技术研发部 7:安全监察部] ”;

cin>>choice2;

e.showdepart(choice2);break;

case 3: cout<<“请输入要查询职工的学历编号: [1:小学 2:初中 3:高中 4:本科 5:硕士 6:博士] ”;

cin>>choice2;

e.showdegree(choice2);break;

case 4: cout<<“请输入要查询的年龄范围: ”;

cout<<“最小值: ”;

cin>>min;

cout<<“最大值: ”;

cin>>max;

e.showage(min,max);break;

case 5: cout<<“请输入要查询的职工编号: ”;

cin>>searchnum;

e.shownum(searchnum);break;

default: cout<<“出错啦!”<

} }

void Employee::showall()//全体职工输出函数

{ int i;

long number;

for(i=0;i

{

number = Enum[i];

shownum(number);

} }

void Employee::showdepart(int depart)//按职工所在部门输出函数

{

int i;

switch(depart)

{

case 1: cout<<“董事会的成员有: ”<

case 2: cout<<“销售部的成员有: ”<

case 3: cout<<“人事部的成员有: ”<

case 4: cout<<“客服中心的成员有: ”<

case 5: cout<<“财务部的成员有: ”<

case 6: cout<<“技术研发部的成员有: ”<

case 7: cout<<“安全监察部的成员有: ”<

default: cout<<“输入错误!>”<

}

for(i=0;i

{

if(Edepart[i] == depart)

{

long number = Enum[i];

shownum(number);

}

else continue;

} }

void Employee::showdegree(int degree)//按职工学历输出函数

{

int i;

switch(degree)

{

case 1:cout<<“初中学历的员工有:”<

case 2:cout<<“初中学历的员工有:”<

case 3:cout<<“高中学历的员工有:”<

case 4:cout<<“本科学历的员工有:”<

case 5:cout<<“硕士学位的员工有:”<

case 6:cout<<“博士学位的员工有:”<

}

for(i=0;i

{

if(Edegree[i] == degree)

{

long number = Enum[i];

shownum(number);

} else continue;

} }

void Employee::showage(int min,int max)//按职工年龄段输出函数

{

int i;

for(i=0;i

{

if(Eage[i]>=min&&Eage[i]<=max)

{

long number = Enum[i];

shownum(number);

}

else continue;

} }

void Employee::shownum(long number)//按职工编号输出函数

{

int i;

for(i=0;i

{

if(Enum[i] == number)

{

cout<<“**********************************”<

cout<<“职工编号:”<

cout<<“姓 名:”<

cout<<“性 别:”;

if(Esex[i]=='F')cout<<“女 ”<

else if(Esex[i]=='M')cout<<“男 ”<

cout<<“年 龄:”<

cout<<“婚姻情况:”;

if(Emarriage[i]=='Y')cout<<“已婚 ”<

else if(Emarriage[i]=='N')cout<<“未婚 ”<

cout<<“学 历:”;

switch(Edegree[i])

{

case 1:cout<<“小 学 ”<

case 2:cout<<“初 中 ”<

case 3:cout<<“高 中 ”<

case 4:cout<<“本 科 ”<

case 5:cout<<“硕 士 ”<

case 6:cout<<“博 士 ”<

}

cout<<“所在部门:”;

switch(Edepart[i])

{

case 1:cout<<“董事会 ”<

case 2:cout<<“销售部 ”<

case 3:cout<<“人事部 ”<

case 4:cout<<“客服中心 ”<

case 5:cout<<“财务部 ”<

case 6:cout<<“技术研发部 ”<

case 7:cout<<“安全监察部 ”<

}

cout<<“所任职务:”;

switch(Eposition[i])

{

case 1:cout<<“临时成员 ”<

case 2:cout<<“正式员工 ”<

case 3:cout<<“部门经理 ”<

case 4:cout<<“主任 ”<

case 5:cout<<“董事长 ”<

}

cout<<“工作时长:”<

cout<<“工资:”<

cout<<“**********************************”<

}

else continue;

} }

void Employee::RefreshInfo()//修改职工信息的函数 {

int cNum = 1000;

DBOperate dbo;

dbo.ReadOut();

void Employee::shownum(long number);

cout<<“请输入您要修改的职工编号:”;

cin>>cNum;

int MN;

MN = Employee::MaxNum();

for(int i=0;i

{

if(Enum[i] == cNum)

{

Employee::shownum(cNum);

cout<<“请输入该职工的新信息: ”<

cout<<“职工姓名: ”;//录入职工的新的数据,职工编号保持不变

cin>>Employee::Employeename;

Ename[i] = Employee::Employeename;

cout<<“职工性别(F为女性,M为男性): ”;

cin>>Employee::Employeesex;

Esex[i] = Employee::Employeesex;

cout<<“职工年龄: ”;

cin>>Employee::Employeeage;

Eage[i] = Employee::Employeeage;

cout<<“职工婚姻状况(Y为已婚,N为未婚): ”;

cin>>Employee::Employeemarriage;

Emarriage[i] = Employee::Employeemarriage;

cout<<“职工学历,请输入相应学历的序号:”<

cout<<“ [1:小学 2:初中 3:高中 4:本科 5:硕士 6:博士] ”;

cin>>Employee::Employeedegree;

while(Employee::Employeedegree!=1&&Employee::Employeedegree!=2&&Employee::Employeedegree!=3&&Employee::Employeedegree!=4&&Employee::Employeedegree!=5&&Employee::Employeedegree!=6)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:小学 2:初中 3:高中 4:本科 5:硕士 6:博士] ”;

cin>>Employee::Employeedegree;

}

Edegree[i] = Employee::Employeedegree;

cout<<“职工所在部门,请输入相应部门的序号: ”<

cout<<“ [1:董事会 2:销售部 3:人事部 4:客服中心 5:财务部 6:技术研发部 7:安全监察部] ”;

cin>>Employee::Employeedepart;

while(Employee::Employeedepart!=1&&Employee::Employeedepart!=2&&Employee::Employeedepart!=3&&Employee::Employeedepart!=4&&Employee::Employeedepart!=5&&Employee::Employeedepart!=6&&Employee::Employeedepart!=7)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:董事会 2:销售部 3:人事部 4:客服中心 5:财务部 6:技术研发部 7:安全监察部] ”;

cin>>Employee::Employeedepart;

}

Edepart[i] = Employee::Employeedepart;

cout<<“职工职位,请输入相应职位的序号:”<

cout<<“ [1:临时职员 2: 正式职员 3:部门经理 4:主任 5:董事长] ”;

cin>>Employee::Employeeposition;

while(Employee::Employeeposition!=1&&Employee::Employeeposition!=2&&Employee::Employeeposition!=3&&Employee::Employeeposition!=4&&Employee::Employeeposition!=5)

{

cout<<“输入有误,请重新输入:”<

cout<<“ [1:临时职员 2: 正式职员 3:部门经理 4:主任 5:董事长] ”;

cin>>Employee::Employeeposition;

}

Eposition[i] = Employee::Employeeposition;

cout<<“员工的工作时(不需要输入单位): ”;

cin>>Employee::Employeeworktime;

Eworktime[i] = Employee::Employeeworktime;

Epay[i] = Employee::Pay(Employee::Employeeposition);

break;

}

}

dbo.WriteIn(0);}

void Employee::DeleteInfo()//删除职工数据的函数

{

char tmp;

int cNum = 1000;

DBOperate dbo;

dbo.ReadOut();

void Employee::shownum(long number);

cout<<“请输入您要删除的职工编号>: ”;

cin>>cNum;

int MN;

MN = Employee::MaxNum();

for(int i=0;i

{

if(Enum[i] == cNum)

Employee::shownum(cNum);

}

cout<<“确认要删除该职工信息?(Y为确认,N为放弃): ”;

cin>>tmp;

if(tmp=='Y')

{

if(i==MN-1)

dbo.WriteIn(-1);

else

{

for(int j=i;j

{ Enum[j] = Enum[j+1];}

dbo.WriteIn(-1);

}

cout<<“ 删除操作成功!”<

} }

float Employee::Pay(int Employeeposition)//根据职工职位计算工资的函数

{

float tmpPay;

tmpPay = Employee::EmployeeBasePay + Employee::Employeeposition Employee::EmployeeBasePay;

*

return tmpPay;}

void DBOperate::WriteIn(int iflag)//数据操作函数—写入

{

DBOperate::RefreshMaxNum(iflag);

ofstream myf(“Employee.txt”);

Employee e;

int MN;

MN = e.MaxNum();

for(int i=0;i

{

myf<

}

myf.close();

return;}

void DBOperate::ReadOut()//数据操作函数—读出

{

ifstream myf(“Employee.txt”);

Employee e;

int MN;

MN = e.MaxNum();

for(int i=0;i

{

myf>>DBOperate::Employeenum>>DBOperate::Employeename>>DBOperate::Employeesex>>DBOperate::Employeeage>>DBOperate::Employeemarriage

>>DBOperate::Employeedegree>>DBOperate::Employeedepart>>DBOperate::Employeeposition>>DBOperate::Employeeworktime>>DBOperate::Employeepay;

Enum[i] = DBOperate::Employeenum;

Ename[i] = DBOperate::Employeename;

Esex[i] = DBOperate::Employeesex;

Eage[i] = DBOperate::Employeeage;

Emarriage[i] = DBOperate::Employeemarriage;

Edegree[i] = DBOperate::Employeedegree;

Edepart[i] = DBOperate::Employeedepart;

Eposition[i] = DBOperate::Employeeposition;

Eworktime[i] = DBOperate::Employeeworktime;

Epay[i] = DBOperate::Employeepay;

}

myf.close();}

void DBOperate::RefreshMaxNum(int iflag)//更新系统中员工计数文件的函数

{

int MaxNum = 0;

ifstream myif(“EmployeeMaxNum.txt”);

myif>>MaxNum;

myif.close();

MaxNum = MaxNum+iflag;

ofstream myof(“EmployeeMaxNum.txt”);

myof<

myof.close();}

int main()//主函数

{

system(“color B0”);//设置当前窗口的背景色和前景色

// 0 = 黑色

= 灰色

// 1 = 蓝色

= 淡蓝色

// 2 = 绿色

A = 淡绿色

// 3 = 浅绿色 B = 淡浅绿色

// 4 = 红色

C = 淡红色

// 5 = 紫色

D = 淡紫色

// 6 = 黄色

E = 淡黄色

// 7 = 白色

F = 亮白色

int select = 0;

while(select!=5)

{

cout<<“ ╭————————————————————————————╮”<

cout<<“ ∣

《主菜单》

∣”<

cout<<“ ├————————————————————————————┤”<

cout<<“ ∣

1.新建并录入职工信息

∣”<

cout<<“ ∣

2.按条件输出职工信息

∣”<

cout<<“ ∣

3.修改指定职工的信息

∣”<

cout<<“ ∣

4.删除职工信息

∣”<

cout<<“ ∣

5.退出系统

∣”<

cout<<“ ╰————————————————————————————╯”<

cout<<“ ——————————————————————————————”<

cout<<“ 请选择您需要功能的代号: ”;

cin>>select;

Employee e;

DBOperate dbo;

switch(select)

{

case 1:

e.NewInfo();break;

case 2:

dbo.ReadOut();

e.ShowInfo();break;

case 3:

e.RefreshInfo();break;

case 4:

e.DeleteInfo();break;

case 5: cout<<“ 退出成功”<

default: cout<<“命令错误!”<

}

if(select == 5)

break;

}

exit(1);

return 0;}

下载学生信息管理系统源代码word格式文档
下载学生信息管理系统源代码.doc
将本文档下载到自己电脑,方便修改和收藏,请勿使用迅雷等下载。
点此处下载文档

文档为doc格式


声明:本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:645879355@qq.com 进行举报,并提供相关证据,工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。

相关范文推荐

    学生信息管理系统

    学生信息管理系统论文 2010-04-01清华领导力培训诺贝尔论文网 在传统模式下利用人工进行学生信息管理系统论文,存在着较多缺点,如:效率底,保密性差,时间一长将产生大量文件和数据......

    学生信息管理系统

    –––––––––––––––––摘 要––––––––––––––––– 学生信息管理系统是典型的信息管理系统 (MIS),其开发主要包括后台数据库的建立和维护以及前端......

    学生信息管理系统

    摘 要 随着网络通信技术的迅速发展和信息技术的广泛应用,计算机的应用已普及到经济和社会生活的各个领域。教育领域也不例外,现今已经出现了各种远程网络在线教育系统、图书馆......

    学生信息管理系统

    目 录 第一章:类图 ........................................................ 5 第二章:用例描述与用例图 ............................................ 6 2.1 用例图 .........

    《学生信息管理系统》实验报告

    《学生信息管理系统》课程设计一,实验目的掌握一些access数据库的表,查询,窗体,报表和宏的应用和技巧。二,使用环境Access2003三,内容与设计思想1. 系统主要有:班级信息表,课程学年......

    学生信息管理系统实验报告

    重庆科创职业学院实 训 报 告题目: 学生信息系统管理专业:计算机信息管理班级:计信管ZB421201学号:2012701287姓名:胡航成绩:指导教师:廖 小 娟完成日期:年月日第一章前言1.1 历史现......

    学生信息管理系统毕业论文

    ``````Q ASP.NET学生信息管理系统毕业论文 摘 要    随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。管理信息系统是一个不断发展......

    学生成绩信息管理系统

    武汉理工大学工程硕士课程论文─《面向对象程序设计》 成绩管理系统 zhai 要 随着Internet的发展,管理软件在各行各业得到重用。学生管理系统是一个教育单位不可缺少的部分,它......