教师工资系统源代码

合集下载

C-教师工资管理系统(分析-代码)-PPT课件

C-教师工资管理系统(分析-代码)-PPT课件

void Output(ofstream& ofs) { ofs<<No<<" "<<Name<<" "<<Duty<<" "<<Hours<<endl; }
double Incoming() { return Salary+(Hours-120)*20; } };
class Assistant:virtual public Person //实验员 { protected: int Allowance; int Hours;
<<CppFriend>>
Person
#No: int #Name: char #Duty: char #Salary: double #next: Person
<<create>>-Person() <<destroy>>-Person()
+Input(): void +Input(ifs: ifstream): void +Output(): void +Output(ofs: ofstream): void +Incoming(): double
Assistant
#Allowance: int #Hours: int
<<create>>-Assistant() +Input(): void +Input(ifs: ifstream): void +Output(): void +Output(ofs: ofstream): void +Incoming(): double

C++ 工资管理系统 源代码

C++ 工资管理系统 源代码

#include<iostream>#include<string>#include<fstream>#include<iomanip>using namespace std; double sum,avarage;int amount=0;int ab=0,cd=0,ef=0; ofstream *file[50];struct xinxi{double jiben;double zhiwu;double gangwei;double yiliao;double gongji;double sum;double sum1;double avarage;struct xinxi *next;};class worker{public:string name;string ID;double sum;double avarage;xinxi sc1;class worker *next; };void luru(worker *head); void search1(worker *head); void search2(worker *head); void xianshi(worker *head); void xiugai(worker *head); void chazhao(worker *head); void shanchu(worker *head); void tianjia(worker *head); void tongji(worker *head); void display();void read(worker *head); void dakai(worker *head);int main(){system("color ff");int x;//bool flag2=0;/*do{do{cin>>x;if(x>=0&&x<=10)flag2=1;else{cout<<"~~~~~~~~~~~~指令错误!!!~~~~~~~~~~"<<endl;cout<<"请选择相应数字进行操作"<<endl;}}while(flag2==0)*/worker *head=new worker;head->next=NULL;while(1){display();cin>>x;if(x==1){cout<<"***************此刻进行职工数据的录入*****************\n";luru(head);cout<<"输入的职工信息为:\n";xianshi(head);display(); //break;}else if(x==2){cout<<"***************此刻进行职工数据的点窜******************\n";xiugai(head);display();//break; //按姓名点窜}else if(x==3){cout<<"***************此刻进行所有职工信息的显示*****************\n";xianshi(head);display();//break; //显示数据}else if(x==4){char z;cout<<"*****************此刻进行所有职工信息查找**************\n";cout<<"请选择查询方式\n";cout<<"(1).姓名查询方式(2).ID查询方式\n";cin>>z;while(z!='1'&&z!='2'){cout<<"**************指令错误********************\n";cout<<"(1).姓名查询方式(2).ID查询方式\n";cin>>z;}switch(z){case '1': search1(head);break;//按姓名查询case '2': search2(head);break;//按学号查询}display();// break;}else if(x==5){cout<<"***************此刻进行指定的职工信息的删除*****************\n";shanchu(head);xianshi(head);display();//break; //删除}else if(x==6){cout<<"****************此刻进行指定的职工信息的添加******************\n";tianjia(head);xianshi(head);display();break;//添加}else if(x==7){cout<<"**********************此刻进行指定的职工信息的统计***************\n";tongji(head);display();// break;}else if(x==8){cout<<"**********************此刻进行指定的职工信息的保留************\n";read(head);display();// break;}else if(x==9){cout<<"************************此刻进行指定的职工信息的翻开****************\n";dakai(head);display();// break;}else{cout<<" ╔═══════════════════════════╗\n";cout<<" ║您已退出职工办理系统, 谢谢您的使用! ║\n";cout<<" ╚═══════════════════════════╝\n";cout<<endl;exit(0);break;}}return 0;}void display(){cout<<" ╔═══════════════════════════╗"<<endl;cout<<" ║☆职工办理系统☆║"<<endl;cout<<" ║═══════════════════════════║"<<endl;cout<<" ║║"<<endl;cout<<" ║(1)职工数据的录入║"<<endl;cout<<" ║(2)职工数据的点窜║"<<endl;cout<<" ║(3)显示职工信息║"<<endl;cout<<" ║(4)查询职工信息║"<<endl;cout<<" ║--(1)按姓名查询║"<<endl;cout<<" ║--(2)按ID查询║"<<endl;cout<<" ║--统计总成就和平均成就║"<<endl;cout<<" ║(5)职工信息的删除║"<<endl;cout<<" ║(6)职工信息的添加║"<<endl;cout<<" ║(7)职工信息的统计║"<<endl;cout<<" ║(8)保留职工信息║"<<endl;cout<<" ║(9〕翻开职工信息║"<<endl;cout<<" ║退出程序║"<<endl;cout<<" ║║"<<endl;cout<<" ║═══════════════════════════║"<<endl;cout<<" ║注:请输入相应括号里的阿拉伯数字来执行相关操作!║"<<endl;cout<<" ║要保留数据请先成立好指定文件:║"<<endl;cout<<" ║(D:\\职工办理系统\\职工信息.txt) ║"<<endl;cout<<" ╟------------------------------------------------------╢"<<endl;cout<<" ║===================谢谢您的使用=======================║"<<endl;cout<<" ╚═══════════════════════════╝"<<endl;cout<<" →请选择相应的数字进行操作: "<<endl;}////////////////////////////////显示学生数据void xianshi(worker *head){worker *work=head->next;cout<<" | name | ID |底子工资|职务工资|岗位津贴|医疗保险|公积金|总工资|平均工资|"<<endl;while(work!=NULL){cout<<" | "<<setw(4)<<(*work).name;cout<<" | "<<setw(4)<<(*work).ID;cout<<" | "<<setw(4)<<(*work).sc1.jiben;cout<<" | "<<setw(4)<<(*work).sc1.zhiwu;cout<<" | "<<setw(4)<<(*work).sc1.gangwei;cout<<" | "<<setw(4)<<(*work).sc1.yiliao;cout<<" | "<<setw(4)<<(*work).sc1.gongji;cout<<" | "<<setw(4)<<(*work).sc1.sum;cout<<" | "<<setw(4)<<(*work).sc1.avarage;cout<<" | "<<endl;work=work->next;}system("pause");}void read(worker *head){char a;worker *work=head->next;cout<<"此刻保留输入职工数据,是否继续操作(y/n)";cin>>a;ofstream outfile("D:\\职工办理系统\\职工信息.txt",ios::out);if(! outfile){cout<<"翻开文件错误\n";cout<<"要保留数据请先成立好指定文件:D:\\职工办理系统\\职工信息.txt\n";exit(0);}while(a!='n'){while(work!=NULL){outfile<<"****************第"<<amount<<"个职工的数据:***************\n";outfile<<" | name | ID |底子工资|职务工资|岗位津贴|医疗保险|公积金|总工资|平均工资|"<<endl;outfile<<" 职工信息: \n" <<" | "<<setw(4)<<(*work).name<<" | "<<setw(4)<<(*work).ID<<" | "<<setw(4)<<(*work).scongji <<"|"<<setw(4)<<(*work).sc1.sum<<"|"<<setw(4)<<(*work).sc1.avarage<<"|"<< endl;amount++;work=work->next;}break;}cout<<"......成功将学生数据保留到<职工信息.txt>中! ";outfile.close();}void dakai(worker *head){worker *work=head->next;ofstream ofile("D:\\职工办理系统\\职工信息.txt",ios::out);work=work->next;}void luru(worker *head){char c;int j=0;worker *p=head;file[j]=new ofstream("D:\\职工办理系统\\职工信息.txt",ios::app);do{worker *work=new worker;cout<<"请输入姓名:"<<setw(10);cin>>(*work).name;cout<<"请输入ID:"<<setw(10);cin>>(*work).ID;cout<<"请输入底子工资:"<<setw(2);cin>>(*work).sc1.jiben;cout<<"请输入职务工资:"<<setw(2);cin>>(*work).sc1.zhiwu;cout<<"请输入岗位津贴:"<<setw(2);cin>>(*work).sc1.gangwei;cout<<"请输入医疗保险:"<<setw(2);cin>>(*work).sc1.yiliao;cout<<"请输入公积金:"<<setw(2);cin>>(*work).sc1.gongji;(*work).sc1.sum=(*work).sc1.gangwei+(*work).sc1.gongji+(*work).sc1.yiliao+(*work).sc1.zhiw u+(*work).sc1.jiben;(*work).sc1.avarage=((*work).sc1.gangwei+(*work).sc1.gongji+(*work).sc1.yiliao+(*work).sc1. zhiwu+(*work).sc1.jiben)/5;(*work).sc1.sum1=(*work).sc1.gangwei+(*work).sc1.zhiwu+(*work).sc1.jiben;if((*work).sc1.sum1>=2000) ab++;if((*work).sc1.sum1>=1500&&(*work).sc1.sum1<2000) cd++;if((*work).sc1.sum1>=1000&&(*work).sc1.sum1<1500) ef++;work->next=p->next;p->next=work;amount++;cout<<"数据录入成功,想继续录入吗(y/n)"; cin>>c;p=p->next;while(c!='y'&&c!='n'){cout<<"指令错误<请输入y/n!>"<<endl;cout<<"数据录入成功,想继续录入吗(y/n)";cin>>c;}}while(c=='y');j++;cout<<"输入了"<<amount<<"个职工的信息."<<endl;}void search1(worker *head){char c;string name;do{worker*work=head->next;bool flag=0;cout<<"请输入要查找的职工的姓名:";cin>>name;do{if(work!=NULL&&name==(*work).name){flag=1;cout<<" | name | ID |底子工资|职务工资|岗位津贴|医疗保险|公积金|总工资|平均工资|"<<endl;cout<<" | "<<setw(4)<<(*work).name;cout<<" | "<<setw(4)<<(*work).ID;cout<<" | "<<setw(4)<<(*work).sc1.jiben;cout<<" | "<<setw(4)<<(*work).sc1.zhiwu;cout<<" | "<<setw(4)<<(*work).sc1.gangwei;cout<<" | "<<setw(4)<<(*work).sc1.yiliao;cout<<" | "<<setw(4)<<(*work).sc1.gongji;cout<<" |"<<setw(4)<<(*work).sc1.sum;cout<<" |"<<setw(4)<<(*work).sc1.avarage;cout<<" | "<<endl;}work=work->next;}while(work!=NULL);if(flag==0)cout<<"对不起!您要查询的职工不存在"<<endl;cout<<"您想继续查询吗(y/n)"; cin>>c;while(c!='y'&&c!='n'){cout<<"指令错误<请输入y/n!>"<<endl;cout<<"您想继续查询吗(y/n)"; cin>>c;}}while(c=='y');}void search2(worker *head){char c;string ID;do{worker *work=head->next;int flag=0;cout<<"请输入要查找职工的ID";cin>>ID;do{if(work!=NULL&&ID==(*work).ID){flag=1;cout<<"你要查询的学生是"<<work->name<<endl;cout<<" | name | ID |底子工资|职务工资|岗位津贴|医疗保险|公积金|总工资|平均工资|"<<endl;cout<<" | "<<setw(4)<<(*work).name;cout<<" | "<<setw(4)<<(*work).ID;cout<<" | "<<setw(4)<<(*work).sc1.jiben;cout<<" | "<<setw(4)<<(*work).sc1.zhiwu;cout<<" | "<<setw(4)<<(*work).sc1.gangwei;cout<<" | "<<setw(4)<<(*work).sc1.yiliao;cout<<" | "<<setw(4)<<(*work).sc1.gongji;cout<<" | "<<setw(4)<<(*work).sc1.sum;cout<<" | "<<setw(4)<<(*work).sc1.avarage;cout<<" | "<<endl;}work=work->next;}while(work!=NULL);if(flag==0)cout<<"对不起!您要查询的职工不存在"<<endl;cout<<"您想继续查询吗(y/n)";cin>>c;while(c!='y'&&c!='n'){cout<<"指令错误<请输入y/n!>"<<endl;cout<<"您想继续查询吗(y/n)"<<endl;cin>>c;}}while(c=='y');}void xiugai(worker *head){string name;char c;do{bool flag2=0;worker *work=head->next;xinxi sc1;cout<<"请输入你要点窜的职工的姓名:";cin>>name;do{if(name==(*work).name){flag2=1;cout<<"请输入新的底子工资:";cin>>sc1.jiben;cout<<"请输入新的职务工资:";cin>>sc1.zhiwu;cout<<"请输入新的岗位津贴:";cin>>sc1.gangwei;cout<<"请输入新的医疗保险:";cin>>sc1.yiliao;cout<<"请输入新的公积金:";cin>>sc1.gongji;(*work).sc1.jiben=sc1.jiben;(*work).sc1.zhiwu=sc1.zhiwu;(*work).sc1.gangwei=sc1.gangwei;(*work).sc1.sum=(*work).sc1.gangwei+(*work).sc1.gongji+(*work).sc1.jiben+(*work).sc1. yiliao+(*work).sc1.zhiwu;(*work).sc1.avarage=((*work).sc1.gangwei+(*work).sc1.gongji+(*work).sc1.jiben+(*work). sc1.yiliao+(*work).sc1.zhiwu)/5;cout<<" | name | ID |底子工资|职务工资|岗位津贴|医疗保险|公积金|总工资|平均工资|"<<endl;cout<<" | "<<setw(4)<<(*work).name;cout<<" | "<<setw(4)<<(*work).ID;cout<<" | "<<setw(4)<<(*work).sc1.jiben;cout<<" | "<<setw(4)<<(*work).sc1.zhiwu;cout<<" | "<<setw(4)<<(*work).sc1.gangwei;cout<<" | "<<setw(4)<<(*work).sc1.yiliao;cout<<" | "<<setw(4)<<(*work).sc1.gongji;cout<<" | "<<setw(4)<<(*work).sc1.sum;cout<<" | "<<setw(4)<<(*work).sc1.avarage;cout<<" | "<<endl;cout<<"数据点窜成功......";break;}work=work->next;}while(work!=NULL);if(flag2==0){cout<<"对不起!您要点窜的职工不存在!请查抄从头输入"<<endl; }cout<<"想继续点窜吗(y/n)";cin>>c;if(c!='y'&&c!='n'){cout<<"指令错误!请从头输入<y/n>";cin>>c;}}while(c=='y');}void shanchu(worker *head){char c;string no;do{int flag=0;cout<<"请输入要删除的职工ID";cin>>no;worker *p,*q;q=head;while(q->next!=NULL&&q->next->ID!=no)q=q->next;if(q->next!=NULL){flag=1;p=q->next;q->next=q->next->next;amount--;free(p);cout<<"......成功删除! ";}if(flag==0)cout<<"对不起!您要删除的职工不存在"<<endl;cout<<"您想继续删除吗(y/n)";cin>>c;while(c!='y'&&c!='n'){cout<<"指令错误<请输入y/n!>"<<endl;cout<<"您想继续删除吗(y/n)";cin>>c;}}while(c=='y');}void tongji(worker *head){char c;string name;do{worker *work=head->next;bool flag=0;cout<<"----总工资和平均工资的计算------"<<endl;cout<<"请输入要统计职工的姓名";cin>>name;do{if(work!=NULL&&name==(*work).name){flag=1;cout<<" | name | ID |底子工资|职务工资|岗位津贴|医疗保险|公积金|总工资|平均工资|"<<endl;cout<<" | "<<setw(4)<<(*work).name;cout<<" | "<<setw(4)<<(*work).ID;cout<<" | "<<setw(4)<<(*work).sc1.jiben;cout<<" | "<<setw(4)<<(*work).sc1.zhiwu;cout<<" | "<<setw(4)<<(*work).sc1.gangwei;cout<<" | "<<setw(4)<<(*work).sc1.yiliao;cout<<" | "<<setw(4)<<(*work).sc1.gongji;cout<<" | "<<setw(4)<<(*work).sc1.sum;cout<<" | "<<setw(4)<<(*work).sc1.avarage;cout<<" | "<<endl;cout<<"超过2000的百分比:"<<endl;cout<<(ab*100)/amount<<"%"<<endl;cout<<"小于2000,大于等于1500"<<endl;cout<<(cd*100)/amount<<"%"<<endl;cout<<"小于1500,大于等于1000"<<endl;cout<<(ef*100)/amount<<"%"<<endl;}work=work->next;}while(work!=NULL);if(flag==0)cout<<"对不起!您要查询的职工不存在"<<endl;cout<<"您想继续查询吗(y/n)"; cin>>c;while(c!='y'&&c!='n'){cout<<"指令错误<请输入y/n!>"<<endl;cout<<"您想继续查询吗(y/n)"; cin>>c;}} while(c=='y');}void tianjia(worker *head){char c;int j=0;worker *p=head;file[j]=new ofstream("D:\\职工办理系统\\职工信息.txt",ios::app);do{worker *work=new worker;cout<<"请输入姓名:"<<setw(10);cin>>(*work).name;cout<<"请输入ID:"<<setw(10);cin>>(*work).ID;cout<<"请输入底子工资:"<<setw(2);cin>>(*work).sc1.jiben;cout<<"请输入职务工资:"<<setw(2);cin>>(*work).sc1.zhiwu;cout<<"请输入岗位津贴:"<<setw(2);cin>>(*work).sc1.gangwei;cout<<"请输入医疗保险:"<<setw(2);cin>>(*work).sc1.yiliao;cout<<"请输入公积金:"<<setw(2);cin>>(*work).sc1.gongji;(*work).sc1.sum=(*work).sc1.gangwei+(*work).sc1.gongji+(*work).sc1.yiliao+(*work).sc1.zhiwu+(*work).sc1.jiben;(*work).sc1.avarage=((*work).sc1.gangwei+(*work).sc1.gongji+(*work).sc1.yiliao+(*work).sc1. zhiwu+(*work).sc1.jiben)/5;(*work).sc1.sum1=(*work).sc1.gangwei+(*work).sc1.zhiwu+(*work).sc1.jiben;if((*work).sc1.sum1>=2000) ab++;if((*work).sc1.sum1>=1500&&(*work).sc1.sum1<2000) cd++;if((*work).sc1.sum1>=1000&&(*work).sc1.sum1<1500) ef++;work->next=p->next;p->next=work;amount++;cout<<"数据添加成功,想继续添加吗(y/n)"; cin>>c;p=p->next;while(c!='y'&&c!='n'){cout<<"指令错误<请输入y/n!>"<<endl;cout<<"数据添加成功,想继续添加吗(y/n)";cin>>c;}}while(c=='y');j++;cout<<"输入了"<<amount<<"个职工的信息."<<endl;}。

教职工工资信息管理系统源代码

教职工工资信息管理系统源代码
break;
case 5: output();/*用户选择5号菜单,程序执行输出数据录的函数*/
break;
case 6: save();/*用户选择6号菜单,程序执行保存数据的函数*/
break;
case 7: read();/*用户选择7号菜单,程序执行读取文件的函数*/
break;
case 8: sort();/*用户选择8号菜单,程序执行排序数据的函数*/
printf("请选择(0--8):");
}
/*添加函数*/
void append()
{int number,i;
FILE *fp;
char filepn[MAX_NUM];
system("cls");
printf("\n您选择的是添加职工!\n");
printf("\n请输入本次添加的职工人数: ");
char findName[30];
system("cls");
printf("\n您选择的是档案查询!\n");
printf(" *****************************请选择查询方式********************************\n");
printf("\t \t 1--按编号查找;\t \t \t \t 2--按姓名查找\n"); /*以下可以修改为子菜单方式:1--按编号查找,2--按姓名查找*/
}
work[MAX_NUM];
void main()
{
void showmenu(); /*声明主菜单函数*/

工资管理系统源代码c++

工资管理系统源代码c++
Leaderluru();
break;
case 3:
jianzhiluru();
break;
default:
Teacher t[100];
Leader x[100];
Jianzhi j[100];
void show()
{
cout << "\t请输入你要录入的对象 :" << endl;
cout << "\t\t 1:教师" << endl;
cout << "\t\t 2:领导" << endl;
t[i].display1();
cout<<"是否保存信息(y(Y)/n(N))"<<endl;
char c;
cin>>c;
if(c=='Y'||c=='y')
{
outfile << t[i].num << " " << t[i].name << " " << t[i].wage
<< " " << x[i].butie << endl;
}
}
}
void jianzhiluru()//教师兼职领导录入
{
ofstream outfile("教师兼职领导.txt", iocout << "上一次输入错误。" << endl;

C语言-课程设计-教师工资管理系统(职工工资管理系统)

C语言-课程设计-教师工资管理系统(职工工资管理系统)

课程设计教师工资管理系统运行平台:VC6.0(其他平台未经测试,不一定保证有效)制作者:弓箭中南大学信息科学与工程学院源代码如下:#include 〈stdio.h>#include 〈stdlib。

h〉#include 〈string.h>#include <conio。

h>#define LEN sizeof(struct teacher)struct teacher{int num;char name[20];char sex[20];char workplace[50];char address[50];long phone;double de_salary;double de_jintie;double de_shenghuobutie;double yingfa_salary;double cost_phone;double cost_water_elec;double cost_rent;double cost_tax;double cost_weisheng;double cost_gongjijin;double cost_all;double shifa_salary;struct teacher *next;};/***********************************读取函数************************************/struct teacher *load(){struct teacher *p1,*p2,*head;FILE *fp;int i=1;if((fp=fopen(”save",”rb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单。

.。

”);getch();return (NULL);}else{head=NULL;p1=(struct teacher *)malloc(LEN);while (fread(p1,LEN—4,1,fp)==1){if(i==1){head=p1;p2=p1;i=2;}else{p2—〉next=p1;p2=p2->next;}p1=(struct teacher *)malloc(LEN);}p2->next=NULL;free(p1);fclose(fp);return(head);}}/**********************************欢迎菜单函数*************************************/void welcome(){printf(”\n\n\n 〉>>>>欢迎使用教师工资管理系统Beta1.2〈<<〈<\n”);printf(” *******************************************************\n”);printf(”* C语言课程设计教师工资管理系统*\n”);printf(”*班级: 电气信息类1001班学号:0909100119 *\n”);printf(”*姓名:弓箭*\n");printf(" *******************************************************\n”);printf(”\n\n 按下任意键进入系统..。

教师工资管理系统程序代码

教师工资管理系统程序代码

{1实发工资=应发工资—扣款—税费。

根据应发工资, 内的不扣税, 1000-2000 扣税超出 1000 元部分的 5%,超出 2000 元部分的 10% ,超过 3000 元的都扣除超出 确定信息的数据结构:struct Salary_type{ char name[20];char num[10];float jbgz;float yfgz;float koukuan;float shuifei;float sfgz;struct salary *prior;struct salary *next;} Salary [N];2.程序应具有以下基本功能: 添加:添加一个或几个的记录,并可选择继续输入或退出。

查询:可按姓名或工号查找记录,若找到,则显示其记录,否 则提示未找到,无论查找成功与否,应还可选择继续查找或退 出。

删除:删除记录。

先查找需要删除的记录,如找到,则删除该 记录,可添加提示,选择确认后删除,否则可以取消该操作; 如果查找失败,则返回没有此记录。

修改:修改记录。

输入姓名并查找,若找到,显示该姓名的所 有信息,并可进行修改;否则提示无此信息。

设计要求:1.核心数据结构用到的结构体要采用动态内存分配和链表结构。

家庭住址也要求存储在动态分配的内存中, 以节约内存。

内存的起始地 址存储在结构体的成员指针 addr 中。

2.使用文件进行存储和管理。

程序启动时可从文件中读取通信信息,或从键盘输入通信信息; 运行过程中如添加或删除记录时也可对文件进 行存取;退出前可选择将通信信息保存到文件中。

3.不同的功能使用不同的函数实现(模块化) ,对每个函数的功能和 调用接口要注释清楚。

对程序其它部分也进行必要的注释。

2011-4-2 22:57 最佳答案 #include<stdio.h>#include<stdlib.h>#include<string.h>typedef struct Salary_type1000 元以2000-3000 元再扣 3000 元部分的 15%。

C语言教师管理系统代码

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"); //清屏}}。

教师工资系统VF程序源代码及其说明

教师工资系统VF程序源代码及其说明

教师工资系统VF程序源代码及其说明程序源代码及其说明1、登陆界面实现代码及截图1.1核心代码void CLogInDlg::OnOK(){// TODO: Add extra validation hereUpdateData(TRUE);if(m_usrName == ""){AfxMessageBox("用户账号不能为空!");return;}if(m_usrPasswd == ""){AfxMessageBox("用户密码不能为空!");return;}CDatabase db;CString sql;db.Open(NULL,FALSE,FALSE,"ODBC;DSN=salaryDB;UID=zha ng,PWD=NULL");ClogInSet* pset = new ClogInSet(&db);sql.Format("select * fromlogin where ID=\\'%s\\' and passwd=\\'%s\\'",m_usrName,m_usrPasswd);pset->Open(AFX_DB_USE_DEFAULT_TYPE,sql);if(m_usrName != pset->m_ID || m_usrPasswd != pset->m_passwd){AfxMessageBox("用户账号或密码错误!");return;}CDialog::OnOK();}1.2 登陆界面2、工资查询实现代码及截图2.1 核心代码void CpaySearch::OnQuery(){// TODO: Add your control notification handler code here CDatabase db;CString sql;db.Open(NULL,FALSE,FALSE,"ODBC;DSN=salaryDB;UID=zha ng,PWD=NULL");Csalaryset* pset = new Csalaryset(&db);int i=0;CString str;CString ty,tm,td;m_years.GetWindowText(ty);m_months.GetWindowText(tm);m_departments.GetWindowText(td);// str.Format("%d",m_years.GetCurSel());// AfxMessageBox(str);if(radioSel == 0){if(m_years.GetCurSel() == 0){m_departments.GetCurSel() != 0)sql.Format("select * from searchSalary where dept=\\'%s\\'",td);elseif(m_months.GetCurSel() != 0 && m_departments.GetCurSel() == 0)sql.Format("select * from searchSalary where month=\\'%s\\'",tm);elseif(m_months.GetCurSel() != 0 && m_departments.GetCurSel() != 0)sql.Format("select * from searchSalary where dept=\\'%s\\' and month=\\'%s\\'",td,tm);elsesql.Format("select * from searchSalary");}else// if(m_years.GetCurSel() != 0){if(m_months.GetCurSel() == 0 && m_departments.GetCurSel() != 0)sql.Format("select * from searchSalary where dept=\\'%s\\' and year=\\'%s\\'",td,ty);elseif(m_months.GetCurSel() != 0 && m_departments.GetCurSel() == 0)sql.Format("select * from searchSalary where month=\\'%s\\' and year=\\'%s\\'",tm,ty);elsem_departments.GetCurSel() != 0)sql.Format("select * from searchSalary where year=\\'%s\\' and month=\\'%s\\' and dept=\\'%s\\'",ty,tm,td);elsesql.Format("select * from searchSalary where year=\\'%s\\'",ty);}}else{UpdateData(TRUE);if(m_years.GetCurSel() == 0){if(m_months.GetCurSel() == 0 && m_departments.GetCurSel() != 0)sql.Format("select * from searchSalary where ID=\\'%s\\' and dept=\\'%s\\'",m_ID,td);elseif(m_months.GetCurSel() != 0 && m_departments.GetCurSel() == 0)sql.Format("select * from searchSalary where ID=\\'%s\\' and month=\\'%s\\'",m_ID,tm);elseif(m_months.GetCurSel() != 0 && m_departments.GetCurSel() != 0)sql.Format("select * from searchSalary where ID=\\'%s\\' anddept=\\'%s\\' and month=\\'%s\\'",m_ID,td,tm);elsesql.Format("select * from searchSalary where ID=\\'%s\\'",m_ID);}else// if(m_years.GetCurSel() != 0){if(m_months.GetCurSel() == 0 && m_departments.GetCurSel() != 0)sql.Format("select * from searchSalary where ID=\\'%s\\' and dept=\\'%s\\' and year=\\'%s\\'",m_ID,td,ty);elseif(m_months.GetCurSel() != 0 && m_departments.GetCurSel() == 0)sql.Format("select * from searchSalary where ID=\\'%s\\' and month=\\'%s\\' and year=\\'%s\\'",m_ID,tm,ty);elseif(m_months.GetCurSel() != 0 && m_departments.GetCurSel() != 0)sql.Format("select * from searchSalary where ID=\\'%s\\' and year=\\'%s\\' and month=\\'%s\\' and dept=\\'%s\\'", m_ID,ty,tm,td);elsesql.Format("select * from searchSalary where ID=\\'%s\\' and year=\\'%s\\'",m_ID,ty);}UpdateData(FALSE);}// sql.Format("select * from searchSalary"); AfxMessageBox(sql);m_printList.DeleteAllItems();pset->Open(AFX_DB_USE_DEFAULT_TYPE,sql); if(pset->GetRecordCount() == 0){delete pset;return;}while(!pset->IsEOF()){str.Format("%s",pset->m_ID);m_printList.InsertItem(i,str);str.Format("%s",pset->m_name);m_printList.SetItemText(i,name,str);str.Format("%s",pset->m_dept);m_printList.SetItemText(i,department,str); str.Format("%s",pset->m_position);m_printList.SetItemText(i,position,str);str.Format("%.2f",pset->m_allowance);m_printList.SetItemText(i,allowance,str);str.Format("%.2f",pset->m_salary);m_printList.SetItemText(i,salary,str);str.Format("%.2f",pset->m_reward);m_printList.SetItemText(i,reward,str);str.Format("%d",pset->m_year);m_printList.SetItemText(i,year,str);str.Format("%d",pset->m_month);m_printList.SetItemText(i,month,str);i++;pset->MoveNext();}db.Close();delete pset;}2.2 查询界面3、教职工基本信息添加实现代码及截图3.1核心代码void CWorkersInfo::OnModify(){// TODO: Add your control notification handler code here int count = m_wkrsInfo.GetItemCount();try{CDatabase db;CString sql;db.Open(NULL,FALSE,FALSE,"ODBC;DSN=salaryDB;UID=zha ng,PWD=NULL");CsysSet *sset = new CsysSet(&db);double al = 0;double sal = 0;// CcheckOnSet *cset = new CcheckOnSet(&db);CTime times = CTime::GetCurrentTime();int year=times.GetYear();int month=times.GetMonth();/* sql.Format("%d",count);AfxMessageBox(sql);sql.Format("%d-%d",year,month);AfxMessageBox(sql);*/CString ID,Name,Pos,Title,Dept,Phone;for(int i = 0;i < count;i++){ID = m_wkrsInfo.GetItemText(i,id);Name = m_wkrsInfo.GetItemText(i,name);Pos = m_wkrsInfo.GetItemText(i,position);Title = m_wkrsInfo.GetItemText(i,title);Dept = m_wkrsInfo.GetItemText(i,department);Phone = m_wkrsInfo.GetItemText(i,phone);/*sql.Format("%s,%s,%s,%s,%s,%s",ID,Name,Pos,Title,Dept,Phone);AfxMessageBox(sql);// Print the sql statement for check.*///-------Add to baseInfo table.-------sql.Format("insert into baseInfo (ID,name,position,title,dept,phone) values (\\'%s\\',\\'%s\\',\\'%s\\',\\'%s\\',\\'%s\\',\\'%s\\')",ID,Name,Pos,Title,Dept,Phone);db.ExecuteSQL(sql);//-------Add to attend table.-------sql.Format("insert into attend (ID,name,attendedTime,extraHours) values (\\'%s\\',\\'%s\\',0,0)",ID,Name);db.ExecuteSQL(sql);//-------Add to searchSalary table.-------/*Get position default salary from table sysSet.*/sql.Format("select * from sysSet where position=\\'%s\\'",Pos);sset->Open(AFX_DB_USE_DEFAULT_TYPE,sql);sal = sset->m_salary;al = sset->m_pAllowance;sql.Format("%.2f",sal);/* AfxMessageBox(sql); // Print the sql statement for check. */sset->Close(); //Close is needed.sql.Format("insert into searchSalary (ID,name,dept,position,allowance,salary,reward,year,month) values(\\'%s\\',\\'%s\\',\\'%s\\',\\'%s\\',\\'%.2f\\',\\'%.2f\\',0,\\'%d\\ ',\\'%d\\')",ID,Name,Dept,Pos,al,sal,year,month);db.ExecuteSQL(sql);}db.Close();}catch(CDBException e){CString err;err.Format("数据库操作错误!");AfxMessageBox(err);}}3.2 教职工信息查询界面4、系统设置实现代码和截图4.1确定修改系统设置实现代码void CSystemSetting::OnConfirm(){// TODO: Add your control notification handler code hereCDatabase db;CString sql,sql1,sql2,sql3,sql4,sql5;sql.Format("select * from sysSet");db.Open(NULL,FALSE,FALSE,"ODBC;DSN=salaryDB;UID=zha ng,PWD=NULL");CsysSet *pset = new CsysSet(&db);pset->Open(AFX_DB_USE_DEFAULT_TYPE,sql);m_1_1 = pset->m_salary;m_1_2 = pset->m_aAllowance;m_1_3 = pset->m_pAllowance;m_1_4 = pset->m_tAllowance;pset->MoveNext();m_2_1 = pset->m_salary;m_2_2 = pset->m_aAllowance;m_2_3 = pset->m_pAllowance;m_2_4 = pset->m_tAllowance;pset->MoveNext();m_3_1 = pset->m_salary;m_3_2 = pset->m_aAllowance;m_3_3 = pset->m_pAllowance;m_3_4 = pset->m_tAllowance;pset->MoveNext();m_4_1 = pset->m_salary;m_4_2 = pset->m_aAllowance;m_4_3 = pset->m_pAllowance;m_4_4 = pset->m_tAllowance;pset->MoveNext();m_5_1 = pset->m_salary;m_5_2 = pset->m_aAllowance;m_5_3 = pset->m_pAllowance;m_5_4 = pset->m_tAllowance;pset->MoveFirst();UpdateData(TRUE);sql1.Format("update sysSet set salary=\\'%.1f\\',aAllowance=\\'%.1f\\',pAllowance=\\'%.1f\\',tA llowance=\\'%.1f\\' where SID=0001", m_1_1,m_1_2,m_1_3,m_1_4);sql2.Format("update sysSet set salary=\\'%.1f\\',aAllowance=\\'%.1f\\',pAllowance=\\'%.1f\\',tA llowance=\\'%.1f\\' where SID=0002", m_2_1,m_2_2,m_2_3,m_2_4);sql3.Format("update sysSet set salary=\\'%.1f\\',aAllowance=\\'%.1f\\',pAllowance=\\'%.1f\\',tA llowance=\\'%.1f\\' where SID=0003", m_3_1,m_3_2,m_3_3,m_3_4);sql4.Format("update sysSet set salary=\\'%.1f\\',aAllowance=\\'%.1f\\',pAllowance=\\'%.1f\\',tA llowance=\\'%.1f\\' where SID=0004", m_4_1,m_4_2,m_4_3,m_4_4);sql5.Format("update sysSet set salary=\\'%.1f\\',aAllowance=\\'%.1f\\',pAllowance=\\'%.1f\\',tA llowance=\\'%.1f\\' where SID=0005", m_5_1,m_5_2,m_5_3,m_5_4);db.ExecuteSQL(sql1);db.ExecuteSQL(sql2);db.ExecuteSQL(sql3);db.ExecuteSQL(sql4);db.ExecuteSQL(sql5);db.Close();}4.2删除教职工信息功能实现代码void CSystemSetting::OnDelete(){// TODO: Add your control notification handler code hereUpdateData(TRUE);if(m_delete==""){AfxMessageBox("请输入教职工编号!");return;}Calert *dlg = new Calert();if(dlg->DoModal()==IDOK){CString sql;CDatabase db;sql.Format("delete from baseInfo where ID=\\'%s\\'",m_delete);db.Open(NULL,FALSE,FALSE,"ODBC;DSN=salaryDB;UID=zha ng,PWD=NULL");db.ExecuteSQL(sql);db.Close();}}。

高校工资管理系统设计源代码

高校工资管理系统设计源代码

#include<iostream>#include<fstream>#include<iomanip>using namespace std;class person //基类{public:bool mark; //存在标记char name[20]; //职工姓名int num; //职工编号double basePay; //基本工资person(bool m,char nm[],int n,double b):mark(m),num(n),basePay(b){strcpy(name,nm);}};class teacher:virtual public person //教师类{public:double classPay; //课时费teacher(bool m,char nm[],int n,double b,double c):person(m,nm,n,b),classPay(c){}void show(){cout<<setw(15)<<"职工类型"<<setw(10)<<"职工编号"<<setw(10)<<"职工姓名"<<setw(10)<<"基本功资"<<setw(10)<<"课时费"<<setw(10)<<"总工资"<<endl;cout<<setw(15)<<"教师"<<setw(10)<<num<<setw(10)<<name<<setw(10)<<basePay<<setw(10)<<classPay<<setw(10)<<classPay +basePay<<endl;}};class lab:virtual public person //实验员类{public:double labPay; //实验室补助lab(bool m,char nm[],int n,double b,double j):person(m,nm,n,b),labPay(j){}void show(){cout<<setw(15)<<"职工类型"<<setw(10)<<"职工编号"<<setw(10)<<"职工姓名"<<setw(10)<<"基本功资"<<setw(10)<<"实验补贴"<<setw(10)<<"总工资"<<endl;cout<<setw(15)<<"实验员"<<setw(10)<<num<<setw(10)<<name<<setw(10)<<basePay<<setw(10)<<labPay<<setw(10)<<labPay+bas ePay<<endl;}};class admin:virtual public person //行政人员类{public:double adminPay; //行政补贴admin(bool m,char nm[],int n,double b,double k):person(m,nm,n,b),adminPay(k){}void show(){cout<<setw(15)<<"职工类型"<<setw(10)<<"职工编号"<<setw(10)<<"职工姓名"<<setw(10)<<"基本功资"<<setw(10)<<"行政补贴"<<setw(10)<<"总工资"<<endl;cout<<setw(15)<<"行政人员"<<setw(10)<<num<<setw(10)<<name<<setw(10)<<basePay<<setw(10)<<adminPay<<setw(10)<<adminPay +basePay<<endl;}};void add() //添加数据函数{ifstream ifile("E:\\data.txt");if(ifile.fail()){ofstream ofile("E:\\data.txt");if(ofile.fail())throw("打开文件失败!");ofile.close();}else ifile.close();fstream file;file.open("E:\\data.txt",ios::in|ios::out|ios::binary);int a,b,c,sign,bh;char xm[20];double jbgz,ksf;cout<<"\t*******************************************************************"<<endl; cout<<"\t* 1.教师 2.实验员 3.行政人员*"<<endl;cout<<"\t*******************************************************************"<<endl; cout<<"\t\t\t请选择添加类型:";cin>>a;switch(a){case 1:{cout<<"\t*******************************************************************"<<endl; cout<<"\t* 1.教授 2.副教授 3.讲师*"<<endl;cout<<"\t*******************************************************************"<<endl; cout<<"\t\t\t请选择添加类型:";cin>>c;switch(c){case 1:{cout<<"\t\t\t输入编号:";cin>>bh;cout<<"\t\t\t输入姓名:";cin>>xm;cout<<"\t\t\t输入基本工资:";cin>>jbgz;cout<<"\t\t\t输入上学期课时工作量:";cin>>b;ksf=b*20;cout<<"\t\t\t课时费:"<<ksf<<endl;cout<<"\t\t\t总工资:"<<ksf+jbgz<<endl;teacher temp(true,xm,bh,jbgz,ksf);sign=1;file.seekg(0,ios::end);file.write((char*)&sign,sizeof(int));file.write((char*)&temp,sizeof(teacher));cout<<"\t\t\t添加成功"<<endl;}break;case 2:{cout<<"\t\t\t输入编号:";cin>>bh;cout<<"\t\t\t输入姓名:";cin>>xm;cout<<"\t\t\t输入基本工资:";cin>>jbgz;cout<<"\t\t\t输入上学期课时工作量:";cin>>b;ksf=b*15;cout<<"\t\t\t课时费:"<<ksf<<endl;cout<<"\t\t\t总工资:"<<ksf+jbgz<<endl;teacher temp(true,xm,bh,jbgz,ksf);sign=2;file.seekg(0,ios::end);file.write((char*)&sign,sizeof(int));file.write((char*)&temp,sizeof(teacher));cout<<"\t\t\t添加成功"<<endl;}break;case 3:{cout<<"\t\t\t输入编号:";cin>>bh;cout<<"\t\t\t输入姓名:";cin>>xm;cout<<"\t\t\t输入基本工资:";cin>>jbgz;cout<<"\t\t\t输入上学期课时工作量:";cin>>b;ksf=b*10;cout<<"\t\t\t课时费:"<<ksf<<endl;cout<<"\t\t\t总工资:"<<ksf+jbgz<<endl;teacher temp(true,xm,bh,jbgz,ksf);sign=3;file.seekg(0,ios::end);file.write((char*)&sign,sizeof(int));file.write((char*)&temp,sizeof(teacher));cout<<"***********************"<<endl;cout<<"\t\t\t添加成功"<<endl;}break;} }break;case 2:{cout<<"\t*******************************************************************"<<endl; cout<<"\t* 1.工程师 2.高级工程师 *"<<endl; cout<<"\t*******************************************************************"<<endl; cout<<"\t\t\t请选择添加类型:";cin>>c;switch(c){case 1:{cout<<"\t\t\t输入编号:";cin>>bh;cout<<"\t\t\t输入姓名:";cin>>xm;cout<<"\t\t\t输入基本工资:";cin>>jbgz;ksf=150;cout<<"\t\t\t实验室补助:"<<ksf<<endl;cout<<"\t\t\t总工资:"<<ksf+jbgz<<endl;lab temp(true,xm,bh,jbgz,ksf);sign=1;file.seekg(0,ios::end);file.write((char*)&sign,sizeof(int));file.write((char*) &temp,sizeof(lab));cout<<"\t\t\t添加成功"<<endl;}break;case 2:{cout<<"\t\t\t输入编号:";cin>>bh;cout<<"\t\t\t输入姓名:";cin>>xm;cout<<"\t\t\t输入基本工资:";cin>>jbgz;ksf=200;cout<<"\t\t\t实验室补助:"<<ksf<<endl;cout<<"\t\t\t总工资:"<<ksf+jbgz<<endl;lab temp(true,xm,bh,jbgz,ksf);sign=2;file.seekg(0,ios::end);file.write((char*)&sign,sizeof(int));file.write((char*) &temp,sizeof(lab));cout<<"\t\t\t添加成功"<<endl;}break;}}break;case 3:{cout<<"\t*******************************************************************"<<endl; cout<<"\t*1.科员 2.科长 3.处长 *"<<endl;cout<<"\t*******************************************************************"<<endl; cout<<"\t\t\t请选择添加类型:";cin>>c;switch(c)case 1:{cout<<"\t\t\t输入编号:";cin>>bh;cout<<"\t\t\t输入姓名:";cin>>xm;cout<<"\t\t\t输入基本工资:";cin>>jbgz; cout<<"\t\t\t输入行政补贴:";cin>>b; cout<<"\t\t\t输入加班费时长:";cin>>ksf;ksf=ksf*20;cout<<"\t\t\t总工资:"<<b+jbgz+ksf<<endl; admin temp(true,xm,bh,jbgz,b);sign=1;file.seekg(0,ios::end);file.write((char*)&sign,sizeof(int));file.write((char*) &temp,sizeof(admin)); cout<<"\t\t\t添加成功"<<endl;}break;case 2:{cout<<"\t\t\t输入编号:";cin>>bh;cout<<"\t\t\t输入姓名:";cin>>xm;cout<<"\t\t\t输入基本工资:";cin>>jbgz; cout<<"\t\t\t输入行政补贴:";cin>>b; cout<<"\t\t\t输入加班费时长:";cin>>ksf; ksf=ksf*25;cout<<"\t\t\t总工资:"<<b+jbgz+ksf<<endl; admin temp(true,xm,bh,jbgz,b);sign=2;file.seekg(0,ios::end);file.write((char*)&sign,sizeof(int));file.write((char*) &temp,sizeof(admin)); cout<<"\t\t\t添加成功"<<endl;}break;case 3:{cout<<"\t\t\t输入编号:";cin>>bh;cout<<"\t\t\t输入姓名:";cin>>xm;cout<<"\t\t\t输入基本工资:";cin>>jbgz; cout<<"\t\t\t输入行政补贴:";cin>>b; cout<<"\t\t\t输入加班费时长:";cin>>ksf; ksf=ksf*30;cout<<"\t\t\t总工资:"<<b+jbgz+ksf<<endl; admin temp(true,xm,bh,jbgz,b);sign=3;file.seekg(0,ios::end);file.write((char*)&sign,sizeof(int));file.write((char*) &temp,sizeof(admin)); cout<<"\t\t\t添加成功"<<endl;}break;}}break;file.close();}}void search() //查询修改函数{ifstream ifile("E:\\data.txt");if(ifile.fail()){ofstream ofile("E:\\data.txt");if(ofile.fail())throw("打开失败");ofile.close();else ifile.close();fstream file;file.open("E:\\data.txt",ios::in|ios::out|ios::binary);int a,b,sign,g=0;char tag,y[20];cout<<"\t*******************************************************************"<<endl;cout<<"\t* 1.职工编号查询 2.职工姓名查询 3.显示所有数据*"<<endl;cout<<"\t*******************************************************************"<<endl;cout<<"\t\t\t请选择:";cin>>b;while(b!=1 && b!=2 && b!=3 && b!=4 && b!=5){cout<<"\t\t\t输入不符,重新输入:";cin>>b;}if(b==1){cout<<"\t\t\t输入要查询的职工编号:";cin>>a;file.seekg(0);file.read((char*)&sign,sizeof(int));while(!file.eof()){if(sign==1){teacher temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(teacher));if(temp.num==a && temp.mark){temp.show();cout<<"\t\t\t是否要修改数据?(Y/N):";cin>>tag;tag=tolower(tag);while(tag!='y' && tag!='n'){cout<<"\t\t\t输入不符,重新输入(Y/N):";cin>>tag;tag=tolower(tag);} if(tag=='y'){temp.mark=false;file.seekg(sizeof(teacher),ios::cur);file.write((char*)&temp,sizeof(teacher));cout<<"\t*******************************************************************\n\t\t\t\t请输入修改后的数据:\n\t*******************************************************************"<<endl;add();}else{cout<<"**********"<<endl;cout<<"\t\t\t修改已取消"<<endl;}g=1;break;}}if(sign==2){lab temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(lab));if(temp.num==a && temp.mark){temp.show();cout<<"\t\t\t是否要修改数据?(Y/N):";cin>>tag;tag=tolower(tag);while(tag!='y' && tag!='n'){cout<<"\t\t\t输入不符,重新输入(Y/N):";cin>>tag;tag=tolower(tag);} if(tag=='y'){temp.mark=false;file.seekg(sizeof(lab),ios::cur);file.write((char*)&temp,sizeof(lab));cout<<"\t*******************************************************************\n\t\t\t\t请输入修改后的数据:\n\t*******************************************************************"<<endl;add();}else{cout<<"———————"<<endl;cout<<"\t\t\t修改已取消"<<endl;}g=1;break;}}if(sign==3){admin temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(admin));if(temp.num==a && temp.mark){temp.show();cout<<"\t\t\t是否要修改数据?(Y/N):";cin>>tag;tag=tolower(tag);while(tag!='y' && tag!='n'){cout<<"\t\t\t输入不符,重新输入(Y/N):";cin>>tag;tag=tolower(tag);} if(tag=='y'){temp.mark=false;file.seekg(sizeof(admin),ios::cur);file.write((char*)&temp,sizeof(admin));cout<<"\t*******************************************************************\n\t\t\t\t请输入修改后的数据:\n\t*******************************************************************"<<endl;add();}else{cout<<"************"<<endl;cout<<"\t\t\t修改已取消"<<endl;}g=1;break;}}file.read((char*)&sign,sizeof(int));}if(g==0){cout<<"*********"<<endl;cout<<"\t\t\t没有记录!"<<endl;}}if(b==2){cout<<"\t\t\t输入要查询的职工姓名:";cin>>y;file.seekg(0);file.read((char*)&sign,sizeof(int));while(!file.eof()){if(sign==1){teacher temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(teacher));if(strcmp(,y)==0 && temp.mark){temp.show();cout<<"\t\t\t是否要修改数据?(Y/N):";cin>>tag;tag=tolower(tag);while(tag!='y' && tag!='n'){cout<<"\t\t\t输入不符,重新输入(Y/N):";cin>>tag;tag=tolower(tag);} if(tag=='y'){temp.mark=false;file.seekg(sizeof(teacher),ios::cur);file.write((char*)&temp,sizeof(teacher));cout<<"\t*******************************************************************\n\t\t\t\t请输入修改后的数据:\n\t*******************************************************************"<<endl;add();}else{cout<<"***********"<<endl;cout<<"\t\t\t修改已取消"<<endl;}g=1;break;}}if(sign==2){lab temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(lab));if(strcmp(,y)==0 && temp.mark){temp.show();cout<<"\t\t\t是否要修改数据?(Y/N):";cin>>tag;tag=tolower(tag);while(tag!='y' && tag!='n'){cout<<"\t\t\t输入不符,重新输入(Y/N):";cin>>tag;tag=tolower(tag);} if(tag=='y'){temp.mark=false;file.seekg(sizeof(lab),ios::cur);file.write((char*)&temp,sizeof(lab));cout<<"\t*******************************************************************\n\t\t\t\t请输入修改后的数据:\n\t*******************************************************************"<<endl;add();}else{cout<<"***********"<<endl;cout<<"\t\t\t修改已取消"<<endl;}g=1;break;}}if(sign==3){admin temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(admin));if(strcmp(,y)==0 && temp.mark){temp.show();cout<<"\t\t\t是否要修改数据?(Y/N):";cin>>tag;tag=tolower(tag);while(tag!='y' && tag!='n'){cout<<"\t\t\t输入不符,重新输入(Y/N):";cin>>tag;tag=tolower(tag);} if(tag=='y'){temp.mark=false;file.seekg(sizeof(admin),ios::cur);file.write((char*)&temp,sizeof(admin));cout<<"\t*******************************************************************\n\t\t\t\t请输入修改后的数据:\n\t*******************************************************************"<<endl;add();}else{cout<<"*************"<<endl;cout<<"\t\t\t修改已经取消"<<endl;}g=1;break;}}file.read((char*)&sign,sizeof(int));}if(g==0){cout<<"**********"<<endl;cout<<"\t\t\t没有记录"<<endl;}}if(b==3){file.seekg(0);file.read((char*)&sign,sizeof(int));while(!file.eof()){if(sign==1){teacher temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(teacher));if(temp.mark){temp.show();g=1;}}if(sign==2){lab temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(lab));if(temp.mark){temp.show();g=1;}}if(sign==3){admin temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(admin));if(temp.mark){temp.show();g=1;}}file.read((char*)&sign,sizeof(int));}if(g==0){cout<<"**********"<<endl;cout<<"\t\t\t没有记录"<<endl;}}file.close();}void del() //删除数据函数{ifstream ifile("E:\\data.txt");if(ifile.fail()){ofstream ofile("E:\\data.txt");if(ofile.fail())throw("打开文件失败!");ofile.close();}else ifile.close();fstream file;file.open("E:\\data.txt",ios::in|ios::out|ios::binary);int a,sign,g=0;char tag;cout<<"\t*******************************************************************\n\t\t\t\t输入要删除的职工编号:\n\t*******************************************************************";cin>>a;file.seekg(0);file.read((char*)&sign,sizeof(int));while(!file.eof()){if(sign==1){teacher temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(teacher));if(temp.num==a && temp.mark){temp.show();cout<<"\t\t\t是否要删除?(Y/N):";cin>>tag;tag=tolower(tag);while(tag!='y' && tag!='n'){cout<<"\t\t\t输入不符,重新输入(Y/N):";cin>>tag;tag=tolower(tag);} if(tag=='y'){temp.mark=false;file.seekg(sizeof(teacher),ios::cur);file.write((char*)&temp,sizeof(teacher));cout<<"**********"<<endl;cout<<"\t\t\t删除成功!"<<endl;}else{cout<<"**********"<<endl;cout<<"\t\t\t删除已取消!"<<endl;}g=1;break;}}if(sign==2){lab temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(lab));if(temp.num==a && temp.mark){temp.show();cout<<"\t\t\t是否要删除?(Y/N):";cin>>tag;tag=tolower(tag);while(tag!='y' && tag!='n'){cout<<"\t\t\t输入不符,重新输入(Y/N):";cin>>tag;tag=tolower(tag);} if(tag=='y'){temp.mark=false;file.seekg(sizeof(lab),ios::cur);file.write((char*)&temp,sizeof(lab));cout<<"**********"<<endl;cout<<"\t\t\t删除成功"<<endl;}else{cout<<"**********"<<endl;cout<<"\t\t\t删除取消"<<endl;}g=1;break;}}if(sign==3){admin temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(admin));if(temp.num==a && temp.mark){temp.show();cout<<"*******************************************************************\n\t\t\t\t是否要删除?(Y/N):\n*******************************************************************";cin>>tag;tag=tolower (tag);while(tag!='y' && tag!='n'){cout<<"\t\t\t输入不符,重新输入(Y/N):";cin>>tag;tag=tolower(tag);} if(tag=='y'){temp.mark=false;file.seekg(sizeof(admin),ios::cur);file.write((char*)&temp,sizeof(admin));cout<<"**********"<<endl;cout<<"\t\t\t删除成功"<<endl;}else{cout<<"**********"<<endl;cout<<"\t\t\t删除成功"<<endl;} g=1;break;}}file.read((char*)&sign,sizeof(int));}if(g==0)cout<<"\t\t\t无记录!"<<endl;file.close();}void end() //重组退出函数{ifstream ifile("E:\\data.txt");if(ifile.fail()){ofstream ofile("E:\\data.txt");if(ofile.fail())throw("打开失败");ofile.close();}else ifile.close();fstream file;file.open("E:\\data.txt",ios::in|ios::out|ios::binary);ofstream outfile("E:\\tem.txt",ios::out|ios::binary);int sign;file.seekg(0);file.read((char*)&sign,sizeof(int));while(!file.eof()){if(sign==1){teacher temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(teacher));if(temp.mark==true){outfile.write((char*)&sign,sizeof(int));outfile.write((char*)&temp,sizeof(teacher));}}if(sign==2){lab temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(lab));if(temp.mark==true){outfile.write((char*)&sign,sizeof(int));outfile.write((char*)&temp,sizeof(lab));}}if(sign==3){admin temp(true,"s",0,0,0);file.read((char*)&temp,sizeof(admin));if(temp.mark==true){outfile.write((char*)&sign,sizeof(int));outfile.write((char*)&temp,sizeof(admin));}}file.read((char*)&sign,sizeof(int));}。

C++_工资管理系统_源代码(总11页)

C++_工资管理系统_源代码(总11页)

C++_工资管理系统_源代码(总11页)-CAL-FENGHAI.-(YICAI)-Company One1-CAL-本页仅作为文档封面,使用请直接删除#include <>#include <>#include <>#include <>#define TITLE "\n 月份工号姓名应发工资各种折扣实发工资\n" #define DATA " %2d %4ld %-10s % % %\n",p1->month,p1->num,p1->name,p1->should_pay,p1->rebate,p1->actual_paytypedef struct pay{long num;short month;char name[20];float gw,jn,zw,zl,jt,yj;float should_pay;float fz,gj,sd,others;float rebate;float actual_pay;struct pay *next;}PAY;FILE *fp;PAY *p1=NULL,*p2=NULL,*head=NULL;void menu();PAY *input();void output();void save(PAY *head);PAY *open();PAY *insert();void search();PAY *del();PAY *revise();/*主程序模块*/void main(void){short sel;do{menu();scanf("%d",&sel);switch(sel){case 1:head=input(); 建工资档案\n");printf("\t\t\t\t2.新增工资信息\n");printf("\t\t\t\t3.修改工资信息\n");printf("\t\t\t\t4.删除工资信息\n");printf("\t\t\t\t5.查找工资信息\n");printf("\t\t\t\t6.分类信息列表\n");printf("\t\t\t\t7.保存信息\n");printf("\t\t\t\t0.退出\n");printf("\n\n\n\n\n\n\n\n");}/*输入模块*/PAY *input(){short n=1;p1=(PAY*)malloc(sizeof(PAY));if(p1==NULL){printf("内存不足,无法创建链表!");getch();}printf("\n请输入第%d位职工的信息(以工号为0结束):\n",n);printf(" 工号:");scanf("%d",&p1->num);if(p1->num==0){printf("按任意键返回!");getch();free(p1);return 0;}getchar();printf(" 姓名:");gets(p1->name);printf(" 工资月份:");scanf("%d",&p1->month);printf(" 岗位工资,技能工资,职务津贴,职龄津贴,交通补贴,业绩津贴:\n");scanf("%f,%f,%f,%f,%f,%f",&p1->gw,&p1->jn,&p1->zw,&p1->zl,&p1->jt,&p1->yj); printf(" 房租扣款,公积金,水电费,其它扣款:\n");scanf("%f,%f,%f,%f",&p1->fz,&p1->gj,&p1->sd,&p1->others);p1->should_pay=p1->gw+p1->jn+p1->zw+p1->zl+p1->jt+p1->yj;p1->rebate=p1->fz+p1->gj+p1->sd+p1->others;p1->actual_pay=p1->should_pay-p1->rebate;while(p1!=NULL){if(n==1)head=p1;elsep2->next=p1;n++;p2=p1;p1=(PAY*)malloc(sizeof(PAY));if(p1==NULL){printf("内存不足,无法创建链表!");getch();}printf("请输入第%d位职工的信息(以工号为0结束):\n",n);printf(" 工号:");scanf("%d",&p1->num);getchar();if(p1->num==0){p1=NULL;break;}printf(" 姓名:");gets(p1->name);printf(" 工资月份:");scanf("%d",&p1->month);printf(" 岗位工资,技能工资,职务津贴,职龄津贴,交通补贴,业绩津贴:\n");scanf("%f,%f,%f,%f,%f,%f",&p1->gw,&p1->jn,&p1->zw,&p1->zl,&p1->jt,&p1->yj); printf(" 房租扣款,公积金,水电费,其它扣款:\n");scanf("%f,%f,%f,%f",&p1->fz,&p1->gj,&p1->sd,&p1->others);p1->should_pay=p1->gw+p1->jn+p1->zw+p1->zl+p1->jt+p1->yj;p1->rebate=p1->fz+p1->gj+p1->sd+p1->others;p1->actual_pay=p1->should_pay-p1->rebate;}p2->next=NULL;部清单\n");printf("\t\t2.按月输出\n");printf("\t\t3.按工资段输出\n");printf("\t\t0.返回\n");scanf("%d",&sel);}while(sel!=1&&sel!=2&&sel!=3&&sel!=0);head=open();if(head==NULL)return;elseswitch(sel){case 1:printf("\n\t\t\t ******全部清单******\n");printf(TITLE);p1=head;do{printf(DATA);p1=p1->next;}while(p1!=NULL);break;case 2:flag=0;printf("输入要查的月份:");scanf("%d",&month);printf("\n\t\t\t******第%d月工资清单******\n",month); printf(TITLE);p1=head;do{if(p1->month==month){printf(DATA);p1=p1->next;flag=1;}elsep1=p1->next;}while(p1!=NULL);if(flag==0)printf("没有该月清单\n");break;case 3:flag=0;printf("输入最低工资:");scanf("%f",&min);printf("输入最高工资:");scanf("%f",&max);printf("\n\t\t ******%到%工资的名单******\n",min,max); printf(TITLE);p1=head;do{if(p1->actual_pay>min&&p1->actual_pay<max){printf(DATA);p1=p1->next;flag=1;}elsep1=p1->next;}while(p1!=NULL);if(flag==0)printf("没有该工资段的职工\n");break;case 0:break;}}while(sel!=0);}/*保存文件*/void save(PAY *head){short write;fp=fopen("","w");if(fp==NULL){printf("创建文件失败!");getch();return;}p1=p2=head;while(p1!=NULL){write=fwrite(p1,sizeof(PAY),1,fp);if(!write){printf("无法写入文件!");getch();return;}p1=p1->next;}fclose(fp);printf("成功存盘!");getch();}/*打开文件*/PAY *open(){short n=1,read;fp=fopen("","r");if(fp==NULL){printf("无法打开档案文件!");getch();return NULL;}if((p1=p2=(PAY*)malloc(sizeof(PAY)))==NULL) {printf("内存不足!");getch();return NULL;}read=fread(p1,sizeof(PAY),1,fp);if(!read){printf("文件读取出错!1");getch();return NULL;}if(p1->next==NULL)head=p1;else{do{if(n==1)head=p1;elsep2->next=p1;n++;p2=p1;if((p1=(PAY*)malloc(sizeof(PAY)))==NULL){printf("内存不足!");getch();return NULL;}read=fread(p1,sizeof(PAY),1,fp);if(!read){printf("文件读取出错!2");getch();return NULL;}}while(p1->next!=NULL);p2->next=p1;}return head;fclose(fp);}/*插入模块*/PAY *insert(){PAY *p3=NULL;char sel;head=open();if(head==NULL)return NULL;elsedo{printf("请输入要插入的职工信息:\n"); p3=(PAY*)malloc(sizeof(PAY));if(p3==NULL){printf("内存不足,无法创建链表!"); getch();}printf(" 工号:");scanf("%d",&p3->num);getchar();printf(" 姓名:");gets(p3->name);printf(" 工资月份:");scanf("%d",&p3->month);printf(" 岗位工资,技能工资,职务津贴,职龄津贴,交通补贴,业绩津贴:\n");scanf("%f,%f,%f,%f,%f,%f",&p3->gw,&p3->jn,&p3->zw,&p3->zl,&p3->jt,&p3->yj); printf(" 房租扣款,公积金,水电费,其它扣款:\n");scanf("%f,%f,%f,%f",&p3->fz,&p3->gj,&p3->sd,&p3->others);p3->should_pay=p3->gw+p3->jn+p3->zw+p3->zl+p3->jt+p3->yj;p3->rebate=p3->fz+p3->gj+p3->sd+p3->others;p3->actual_pay=p3->should_pay-p3->rebate;p1=head;while(p1!=NULL){p2=p1;p1=p1->next;}p2->next=p3;p3->next=NULL;printf("成功插入,是否继续?是(Y)否(N)\n");sel=getch();}while(sel=='Y'||sel=='y');printf("\n任意键返回,并存盘……\n");getch();return head;}/*查找模块*/void search(){short sel;long num;char name[20],choose;head=open();if(head==NULL)return;elsedo{do{printf("\n选择查找方式:\n");printf("\t\t1.按工号查找\n");printf("\t\t2.按姓名查找\n");scanf("%d",&sel);getchar();}while(sel!=1&&sel!=2);switch(sel){case 1:printf("输入要查的工号:");scanf("%ld",&num);break;case 2:printf("输入要查的姓名:");gets(name);break;}p1=head;while((p1->next!=NULL)&&(p1->num!=num)&&(strcmp(p1->name,name)!=0)) 工号删除\n");printf("\t\t2.按姓名删除\n");scanf("%d",&sel);getchar();}while(sel!=1&&sel!=2);switch(sel){case 1:printf("输入要删除的工号:");scanf("%ld",&num);break;case 2:printf("输入要删除的姓名:");gets(name);break;}p1=head;if((p1->num==num)||strcmp(p1->name,name)==0){head=p1->next;printf("删除信息成功!");}else{while((p1->next!=NULL)&&(p1->num!=num)&&(strcmp(p1->name,name)!=0)) {p2=p1;p1=p1->next;}if((p1->num==num)||strcmp(p1->name,name)==0){p2->next=p1->next;free(p1);printf("\n删除信息成功!\n");}elseprintf("\n没有该信息!\n");}printf("是否继续?是(Y)否(N)\n"); choose=getch();}while(choose=='Y'||choose=='y');printf("任意键返回,并存盘……");getch();return head;}/*修改模块*/PAY *revise(){short sel;long num;char name[20],choose;head=open();if(head==NULL)return NULL;elsedo{do{printf("\n查找要修改的对象:\n");printf("\t\t1.按工号查找\n");printf("\t\t2.按姓名查找\n");scanf("%d",&sel);getchar();}while(sel!=1&&sel!=2);switch(sel){case 1:printf("输入要查的工号:");scanf("%ld",&num);break;case 2:printf("输入要查的姓名:");gets(name);break;}p1=head;while((p1->next!=NULL)&&(p1->num!=num)&&(strcmp(p1->name,name)!=0)) //用成p1!=NULL有问题?p1=p1->next;if((p1->num==num)||strcmp(p1->name,name)==0){printf("您要修改的原始信息如下:\n");printf(TITLE);printf(DATA);printf("\n将上述信息改为如下信息:\n");printf(" 工号:");scanf("%d",&p1->num);getchar();printf(" 姓名:");gets(p1->name);printf(" 工资月份:");scanf("%d",&p1->month);printf(" 岗位工资,技能工资,职务津贴,职龄津贴,交通补贴,业绩津贴:\n");scanf("%f,%f,%f,%f,%f,%f",&p1->gw,&p1->jn,&p1->zw,&p1->zl,&p1->jt,&p1->yj); printf(" 房租扣款,公积金,水电费,其它扣款:\n");scanf("%f,%f,%f,%f",&p1->fz,&p1->gj,&p1->sd,&p1->others);p1->should_pay=p1->gw+p1->jn+p1->zw+p1->zl+p1->jt+p1->yj;p1->rebate=p1->fz+p1->gj+p1->sd+p1->others;p1->actual_pay=p1->should_pay-p1->rebate;}elseprintf("你要修改的信息不存在!\n");printf("是否继续?是(Y)否(N)\n");choose=getch();}while(choose=='Y'||choose=='y');printf("任意键返回,并存盘……");getch();return head;}。

java教师工资管理系统完整代码

java教师工资管理系统完整代码

教师工资管理系统:开发团队:206和207时间:2012年4月8日数据库配置:sqlserver2000创建数据库SalaryManagement 在其下创建数据表logindata、创建数据表Employee创建数据表January创建数据表February 创建数据表March 创建数据库April创建数据表May创建数据表June创建数据表July创建数据表August创建数据表September创建数据表October创建数据表November创建数据表December开发工具JDK1.6.21和eclipse,数据库驱动jdbc配置和导入省略。

程序代码如下import java.awt.BorderLayout;import java.awt.Dimension;import java.awt.FlowLayout;import java.awt.Font;import java.awt.GridLayout;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import javax.swing.ButtonGroup;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JRadioButton;import javax.swing.JTextField;public class Login extends JFrame{private JLabel lbTitle, lbUser, lbPwd;private JButton btnLogon,btnOK, btnExit;private Boolean lean=null;JTextField tfUser = new JTextField(15);JPasswordField tfPwd = new JPasswordField(15);JRadioButton radiobutton1=new JRadioButton("教师登陆");JRadioButton radiobutton2=new JRadioButton("管理登陆");ButtonGroup buttongroup=new ButtonGroup();String username=tfUser.getText();String password=new String(tfPwd.getPassword());public Login(){try{init();}catch(Exception e3){e3.printStackTrace();}}public void init() {this.setTitle("登陆界面");this.setBounds(450, 300, 400, 300);JPanel p = new JPanel(new BorderLayout());p.setBounds(0, 0, 500, 400);JPanel p1 = new JPanel(new FlowLayout());JPanel p2 = new JPanel(new GridLayout(2,1));JPanel p21 = new JPanel(new FlowLayout());JPanel p22 = new JPanel(new FlowLayout());JPanel p3 = new JPanel(new FlowLayout());buttongroup.add(radiobutton1);buttongroup.add(radiobutton2);this.lbUser = new JLabel(" 用户名:");this.lbPwd = new JLabel("密码:");this.tfUser = new JTextField(15);this.tfPwd = new JPasswordField(15);this.tfPwd.setEchoChar('*');this.btnLogon=new JButton("注册");this.btnOK = new JButton(" 登录");this.btnExit = new JButton("退出");this.btnLogon.addActionListener(new ActionMonitor());this.btnOK.addActionListener(new ActionMonitor());this.btnExit.addActionListener(new ActionMonitor());p1.add(radiobutton1);p1.add(radiobutton2);p21.add(this.lbUser);p21.add(this.tfUser);p22.add(this.lbPwd);p22.add(this.tfPwd);p3.add(btnLogon);p3.add(this.btnOK);p3.add(this.btnExit);p2.add(p21);p2.add(p22);p.add(p1, BorderLayout.NORTH);p.add(p2, BorderLayout.CENTER);p.add(p3, BorderLayout.SOUTH);p.setVisible(true);this.add(p);this.pack();this.setVisible(true);this.addWindowListener(new WindowMonitor());}class WindowMonitor extends WindowAdapter {public void windowClosing(WindowEvent e) {setVisible(false);System.exit(0);}}class ActionMonitor implements ActionListener {public void actionPerformed(ActionEvent e) {try{if(e.getSource()==btnOK){if(radiobutton2.isSelected()){ManageUser user1= new ManageUser();user1.setName(tfUser.getText());user1.setPassword(new String(tfPwd.getPassword()));ManageCheck ar1 = new ManageCheck(user1);if(ar1.check()){new ManagementFrame().setVisible(true);}else{JOptionPane.showMessageDialog(null,"账号或密码错误","警告",JFrame.EXIT_ON_CLOSE);tfUser.setText("");tfPwd.setText("");}}else if(radiobutton1.isSelected()){User user= new User();user.setUserName(tfUser.getText());user.setPassWord(new String(tfPwd.getPassword()));ActionCheck ar = new ActionCheck(user);if(ar.check()){new TeacherFrame().setVisible(true);}else{JOptionPane.showMessageDialog(null,"账号或密码错误","警告",JFrame.EXIT_ON_CLOSE);tfUser.setText("");tfPwd.setText("");}}}else if(e.getSource() == btnExit) {setVisible(false);System.exit(0);}else if(e.getSource()==btnLogon){new LogonFrame().setVisible(true);}}catch(Exception e2){e2.printStackTrace();}}}public static void main(String[] args){Login frame=new Login();Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();Dimension frameSize =frame.getSize();if(frameSize.height>screenSize.height)frameSize.height=screenSize.height;if(frameSize.width>screenSize.width)frameSize.width=screenSize.width;frame.setLocation((screenSize.width-frameSize.width)/2,(screenSize.height-fram eSize.height)/2);frame.setVisible(true);}}import java.awt.*;import java.sql.*;import javax.swing.*;import java.awt.event.*;public class LogonFrame extends JFrame {Connection con;Statement st;JLabel jLabel1=new JLabel("职工工号");JLabel jLabel2=new JLabel("登陆密码");JLabel jLabel3=new JLabel("职工姓别");JLabel jLabel4=new JLabel("职工性名");JLabel jLabel5=new JLabel("职工年龄");JLabel jLabel6=new JLabel("所属院系");JLabel jLabel7=new JLabel("家庭住址");JLabel jLabel8=new JLabel("联系电话");JTextField jTextField1=new JTextField();JPasswordField jTextField2=new JPasswordField();JTextField jTextField3=new JTextField();JTextField jTextField4=new JTextField();JTextField jTextField5=new JTextField();JTextField jTextField6=new JTextField();JTextField jTextField7=new JTextField();JRadioButton jRadioButton1=new JRadioButton("男");JRadioButton jRadioButton2=new JRadioButton("女");ButtonGroup buttonGroup1=new ButtonGroup();JButton jButton1=new JButton("注册");JButton jButton2=new JButton("取消");public LogonFrame(){try{bInit();}catch(Exception exception){exception.printStackTrace();}}private void bInit() throws Exception{con=DB.getConn();st=con.createStatement();this.setTitle("注册界面");this.setLayout(null);this.setSize(450, 450);this.setLocationRelativeTo(null);jLabel1.setBounds(new Rectangle(21,17,64,24));jLabel2.setBounds(new Rectangle(21,51,53,22));jLabel3.setBounds(new Rectangle(21,86,61,27));jLabel4.setBounds(new Rectangle(21,122,59,25));jLabel5.setBounds(new Rectangle(21,168,54,24));jLabel6.setBounds(new Rectangle(21,205,54,24));jLabel7.setBounds(new Rectangle(21,245,54,24));jLabel8.setBounds(new Rectangle(21,285,54,25));jTextField1.setBounds(new Rectangle(102,10,100,30));jTextField2.setBounds(new Rectangle(102,49,200,30));jTextField3.setBounds(new Rectangle(102,117,100,33));jTextField4.setBounds(new Rectangle(102,163,100,29));jTextField5.setBounds(new Rectangle(102,200,200,29));jTextField6.setBounds(new Rectangle(102,240,200,29));jTextField7.setBounds(new Rectangle(102,280,200,29));jRadioButton1.setBounds(new Rectangle(102,83,65,30));jRadioButton2.setBounds(new Rectangle(190,85,85,30));jButton1.setBounds(new Rectangle(130,320,60,32));jButton2.setBounds(new Rectangle(200,320,60,32));jRadioButton1.setSelected(true);jButton1.addActionListener(new ActionMonitor());jButton2.addActionListener(new ActionMonitor());this.add(jLabel1);this.add(jTextField1);this.add(jLabel2);this.add(jTextField2);this.add(jLabel3);buttonGroup1.add(jRadioButton1);buttonGroup1.add(jRadioButton2);this.add(jRadioButton1);this.add(jRadioButton2);this.add(jLabel4);this.add(jTextField3);this.add(jLabel5);this.add(jTextField4);this.add(jLabel6);this.add(jTextField5);this.add(jLabel7);this.add(jTextField6);this.add(jLabel8);this.add(jTextField7);this.add(jButton1);this.add(jButton2);}class ActionMonitor implements ActionListener{public void actionPerformed(ActionEvent e){String EmployeeID=jTextField1.getText();String EmployeePassword=new String(jTextField2.getPassword());String EmployeeSex="";if(jRadioButton1.isSelected())EmployeeSex+="男";if(jRadioButton2.isSelected())EmployeeSex+="女";String EmployeeName=jTextField3.getText();String EmployeeIge=jTextField4.getText();String EmployeeCollege=jTextField5.getText();String EmployeeAddress=jTextField6.getText();String EmployeeTell=jTextField7.getText();try{if(e.getSource()==jButton1){if(EmployeeID.equals("")|EmployeePassword.equals("")|EmployeeName.equals( "")|EmployeeIge.equals("")|EmployeeCollege.equals("")|EmployeeAddress.equals("") |EmployeeTell.equals("")){JOptionPane.showMessageDialog(null,"内容不允许为空","警告",JFrame.EXIT_ON_CLOSE);}else {st.execute("set dateformat ymd");st.executeUpdate("insert into Employee values('"+EmployeeID+"','"+EmployeePassword+"','"+EmployeeName+"','"+EmployeeSex+"','"+EmployeeIge+"','"+EmployeeCollege+"','"+EmployeeAddress+"','"+Empl oyeeTell+"')");JOptionPane.showMessageDialog(null,"职工添加成功!","提示",JFrame.EXIT_ON_CLOSE);jTextField1.setText("");jTextField2.setText("");jTextField3.setText("");jTextField4.setText("");jTextField5.setText("");jTextField6.setText("");}}else if(e.getSource()==jButton2){jTextField1.setText("");jTextField2.setText("");jTextField3.setText("");jTextField4.setText("");jTextField5.setText("");jTextField6.setText("");jTextField7.setText("");}}catch(Exception ex){JOptionPane.showMessageDialog(null,"职工添加失败!","提示",JFrame.EXIT_ON_CLOSE);ex.printStackTrace();}}}}import java.awt.*;import java.awt.event.*;import javax.swing.*;public class ManagementFrame extends JFrame implements ActionListener{JPanel contentPane;JLayeredPane contentPane1;JMenuBar jMenuBar1=new JMenuBar();JMenu jMenu0=new JMenu("系统");JMenuItem jMenuItem0=new JMenuItem("退出");JMenuItem jMenuItem10=new JMenuItem("主界面");JMenu jMenu1=new JMenu("职工管理");JMenuItem jMenuItem1=new JMenuItem("添加职工");JMenuItem jMenuItem2=new JMenuItem("修改职工");JMenuItem jMenuItem3=new JMenuItem("删除职工");JMenu jMenu2=new JMenu("工资管理");JMenuItem jMenuItem4=new JMenuItem("添加工资");JMenuItem jMenuItem5=new JMenuItem("修改工资");JMenuItem jMenuItem8=new JMenuItem("工资查询");JMenu jMenu3=new JMenu("职工查询");JMenuItem jMenuItem6=new JMenuItem("按工号查询");JMenuItem jMenuItem7=new JMenuItem("按姓名查询");JMenu jMenu4=new JMenu("帮助");JMenuItem jMenuItem9=new JMenuItem("互动");public ManagementFrame(){try{setDefaultCloseOperation(EXIT_ON_CLOSE);Init();}catch(Exception exception){exception.printStackTrace();}}private void Init() throws Exception{setContentPane(new Layeredpane());setSize(new Layeredpane().getWidth(),new Layeredpane().getHeight());setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setTitle("教师工资管理小系统");setLocationRelativeTo(null);jMenuItem0.addActionListener(this);jMenuItem1.addActionListener(this);jMenuItem2.addActionListener(this);jMenuItem3.addActionListener(this);jMenuItem4.addActionListener(this);jMenuItem5.addActionListener(this);jMenuItem6.addActionListener(this);jMenuItem7.addActionListener(this);jMenuItem8.addActionListener(this);jMenuItem9.addActionListener(this);jMenuItem10.addActionListener(this);setJMenuBar(jMenuBar1);jMenuBar1.add(jMenu0);jMenuBar1.add(jMenu1);jMenuBar1.add(jMenu2);jMenuBar1.add(jMenu3);jMenuBar1.add(jMenu4);jMenu0.add(jMenuItem10);jMenu0.add(jMenuItem0);jMenu1.add(jMenuItem1);jMenu1.add(jMenuItem2);jMenu1.add(jMenuItem3);jMenu2.add(jMenuItem4);jMenu2.add(jMenuItem5);jMenu2.add(jMenuItem8);jMenu3.add(jMenuItem6);jMenu3.add(jMenuItem7);jMenu4.add(jMenuItem9);}public void actionPerformed(ActionEvent actionEvent){if(actionEvent.getSource()==jMenuItem0){System.exit(0);}if(actionEvent.getSource()==jMenuItem1){AddEmployee addemployee=new AddEmployee();this.remove(this.getContentPane());this.setContentPane(addemployee);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem2){ModifyEmployee ModifyEmp=new ModifyEmployee();this.remove(this.getContentPane());this.setContentPane(ModifyEmp);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem3){DeleteEmployee DeleteEmp=new DeleteEmployee();this.remove(this.getContentPane());this.setContentPane(DeleteEmp);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem4){AddSalary AddSal=new AddSalary();this.remove(this.getContentPane());this.setContentPane(AddSal);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem5){ModifySalary ModifySal=new ModifySalary();this.remove(this.getContentPane());this.setContentPane(ModifySal);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem8){SalaryInquire SalaryInq=new SalaryInquire();this.remove(this.getContentPane());this.setContentPane(SalaryInq);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem6){InquireOnGH OnGH=new InquireOnGH();this.remove(this.getContentPane());this.setContentPane(OnGH);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem7){InquireOnName OnName=new InquireOnName();this.remove(this.getContentPane());this.setContentPane(OnName);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem9){EmployeeHelp EmployeeH=new EmployeeHelp();this.remove(this.getContentPane());this.setContentPane(EmployeeH);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem10){Layeredpane layeredpane=new Layeredpane();this.remove(this.getContentPane());this.setContentPane(layeredpane);this.setVisible(true);}}}import java.awt.*;import java.awt.event.*;import java.beans.Statement;import java.sql.Connection;import javax.swing.*;public class TeacherFrame extends JFrame implements ActionListener {Connection conn;Statement stmt;JPanel contentPane;JLayeredPane contentPane1;JMenuBar jMenuBar1=new JMenuBar();JMenu jMenu0=new JMenu("系统");JMenuItem jMenuItem0=new JMenuItem("退出");JMenuItem jMenuItem1=new JMenuItem("主界面");JMenu jMenu1=new JMenu("工资管理");JMenuItem jMenuItem2=new JMenuItem("工资查询");JMenu jMenu2=new JMenu("职工查询");JMenuItem jMenuItem4=new JMenuItem("按工号查询");JMenuItem jMenuItem5=new JMenuItem("按姓名查询");JMenu jMenu3=new JMenu("帮助");JMenuItem jMenuItem6=new JMenuItem("互动");JMenu jMenu4=new JMenu("密码设置");JMenuItem jMenuItem7=new JMenuItem("增加密码");JMenuItem jMenuItem8=new JMenuItem("修改密码");public TeacherFrame(){try{setDefaultCloseOperation(EXIT_ON_CLOSE);jbInit();}catch(Exception exception){exception.printStackTrace();}}private void jbInit() throws Exception{setContentPane(new Layeredpane());setSize(new Layeredpane().getWidth(),new Layeredpane().getHeight());setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setTitle("教师工资管理小系统");setLocationRelativeTo(null);jMenuItem0.addActionListener(this);jMenuItem1.addActionListener(this);jMenuItem2.addActionListener(this);jMenuItem4.addActionListener(this);jMenuItem5.addActionListener(this);jMenuItem6.addActionListener(this);setJMenuBar(jMenuBar1);jMenuBar1.add(jMenu0);jMenuBar1.add(jMenu1);jMenuBar1.add(jMenu2);jMenuBar1.add(jMenu4);jMenuBar1.add(jMenu3);jMenu0.add(jMenuItem1);jMenu0.add(jMenuItem0);jMenu1.add(jMenuItem2);jMenu2.add(jMenuItem4);jMenu2.add(jMenuItem5);jMenu3.add(jMenuItem6);jMenu4.add(jMenuItem7);jMenu4.add(jMenuItem8);}public void actionPerformed(ActionEvent actionEvent){if(actionEvent.getSource()==jMenuItem0){System.exit(0);}if(actionEvent.getSource()==jMenuItem1){Layeredpane layeredpane=new Layeredpane();this.remove(this.getContentPane());this.setContentPane(layeredpane);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem2){SalaryInquire SalaryInq=new SalaryInquire();this.remove(this.getContentPane());this.setContentPane(SalaryInq);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem4){InquireOnGH OnGH=new InquireOnGH();this.remove(this.getContentPane());this.setContentPane(OnGH);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem5){InquireOnName OnName=new InquireOnName();this.remove(this.getContentPane());this.setContentPane(OnName);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem6){EmployeeHelp EmployeeH=new EmployeeHelp();this.remove(this.getContentPane());this.setContentPane(EmployeeH);this.setVisible(true);}if(actionEvent.getSource()==jMenuItem7){}if(actionEvent.getSource()==jMenuItem8){}}}import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;public class ActionCheck {private User user;ActionCheck(User user) {er = user;}public boolean check() {boolean isAdmin = false;Connection conn = null;PreparedStatement pstmt = null;ResultSet rs = null;String sql = "";try {conn = DB.getConn();sql = "select * from Employee where employeeid=? and password=?";pstmt = DB.getPstmt(conn, sql);pstmt.setString(1, user.getUserName());pstmt.setString(2, user.getPassWord());rs = DB.getRs(pstmt);if (rs.next()) {isAdmin = true;}} catch (SQLException e) {e.printStackTrace();} finally {DB.close(rs);DB.close(pstmt);DB.close(conn);}return isAdmin;}public User getUser() {return user;}public void setUser(User user) {er = user;}}import java.awt.*;import java.sql.*;import javax.swing.*;import java.awt.event.*;public class AddEmployee extends JPanel implements ActionListener {Connection con;Statement st;JButton jButton1=new JButton("确定");JLabel jLabel1=new JLabel("职工工号");JLabel jLabel2=new JLabel("职工姓名");JLabel jLabel3=new JLabel("职工性别");JLabel jLabel4=new JLabel("职工年龄");JLabel jLabel5=new JLabel("所属院系");JLabel jLabel6=new JLabel("家庭住址");JLabel jLabel7=new JLabel("联系电话");JTextField jTextField1=new JTextField();JTextField jTextField2=new JTextField();JTextField jTextField3=new JTextField();JTextField jTextField4=new JTextField();JTextField jTextField5=new JTextField();JTextField jTextField6=new JTextField();JRadioButton jRadioButton1=new JRadioButton("男");JRadioButton jRadioButton2=new JRadioButton("女");ButtonGroup buttonGroup1=new ButtonGroup();public AddEmployee(){try{jbInit();}catch(Exception exception){exception.printStackTrace();}}private void jbInit() throws Exception{con=DB.getConn();st=con.createStatement();this.setLayout(null);jLabel1.setBounds(new Rectangle(21,17,64,24));jLabel2.setBounds(new Rectangle(21,51,53,22));jLabel3.setBounds(new Rectangle(21,86,61,27));jLabel4.setBounds(new Rectangle(21,122,59,25));jLabel5.setBounds(new Rectangle(21,168,54,24));jLabel6.setBounds(new Rectangle(21,205,54,24));jLabel7.setBounds(new Rectangle(21,245,54,24));jTextField1.setBounds(new Rectangle(102,10,200,30));jTextField2.setBounds(new Rectangle(102,49,200,30));jTextField3.setBounds(new Rectangle(102,117,80,33));jTextField4.setBounds(new Rectangle(102,163,200,29));jTextField5.setBounds(new Rectangle(102,200,200,29));jTextField6.setBounds(new Rectangle(102,240,200,29));jRadioButton1.setBounds(new Rectangle(102,83,65,30));jRadioButton2.setBounds(new Rectangle(190,85,85,30));jButton1.setBounds(new Rectangle(130,280,150,32));jRadioButton1.setSelected(true);jButton1.addActionListener(this);this.add(jLabel1);this.add(jTextField1);this.add(jLabel2);this.add(jTextField2);this.add(jLabel3);buttonGroup1.add(jRadioButton1);buttonGroup1.add(jRadioButton2);this.add(jRadioButton1);this.add(jRadioButton2);this.add(jLabel4);this.add(jTextField3);this.add(jLabel5);this.add(jTextField4);this.add(jLabel6);this.add(jTextField5);this.add(jLabel7);this.add(jTextField6);this.add(jButton1);}public void actionPerformed(ActionEvent e){String EmployeeID=jTextField1.getText();String EmployeeName=jTextField2.getText();String EmployeeSex="";if(jRadioButton1.isSelected())EmployeeSex+="男";if(jRadioButton2.isSelected())EmployeeSex+="女";String EmployeeAge=jTextField3.getText();String EmployeeCollege=jTextField4.getText();String EmployeeAddress=jTextField5.getText();String EmployeePhone=jTextField6.getText();try{st.execute("set dateformat ymd");st.executeUpdate("insert into Employee values('"+EmployeeID+"','"+""+"','"+EmployeeName+"','"+EmployeeSex+"','"+Empl oyeeAge+"','"+EmployeeCollege+"','"+EmployeeAddress+"','"+EmployeePhone+"')") ;JOptionPane.showMessageDialog(this,"职工添加成功!");jTextField1.setText("");jTextField2.setText("");jTextField3.setText("");jTextField4.setText("");jTextField5.setText("");jTextField6.setText("");}catch(Exception ex){JOptionPane.showMessageDialog(this,"职工添加失败!");ex.printStackTrace();}}}import java.awt.*;import java.sql.*;import javax.swing.*;import java.awt.event.*;public class AddSalary extends JPanel implements ActionListener{Connection con;Statement st;String month=null;JLabel jLabel1=new JLabel("职工工号");JLabel jLabel2=new JLabel("职工工资");JLabel jLabel3=new JLabel("增加月份");JTextField jTextField1=new JTextField();JTextField jTextField2=new JTextField(); JRadioButton jradiobutton1=new JRadioButton("一"); JRadioButton jradiobutton2=new JRadioButton("二"); JRadioButton jradiobutton3=new JRadioButton("三"); JRadioButton jradiobutton4=new JRadioButton("四"); JRadioButton jradiobutton5=new JRadioButton("五"); JRadioButton jradiobutton6=new JRadioButton("六"); JRadioButton jradiobutton7=new JRadioButton("七"); JRadioButton jradiobutton8=new JRadioButton("八"); JRadioButton jradiobutton9=new JRadioButton("九"); JRadioButton jradiobutton10=new JRadioButton("十"); JRadioButton jradiobutton11=new JRadioButton("十一"); JRadioButton jradiobutton12=new JRadioButton("十二"); JButton jButton1=new JButton("添加工资"); ButtonGroup buttongroup=new ButtonGroup();String EmployeeID=jTextField1.getText();String EmployeeSalary=jTextField2.getText();public AddSalary(){try{jbInit();}catch(Exception exception){exception.printStackTrace();}}private void jbInit() throws Exception{con=DB.getConn();st=con.createStatement();this.setLayout(null);buttongroup.add(jradiobutton1);buttongroup.add(jradiobutton2);buttongroup.add(jradiobutton3);buttongroup.add(jradiobutton4);buttongroup.add(jradiobutton5);buttongroup.add(jradiobutton6);buttongroup.add(jradiobutton7);buttongroup.add(jradiobutton8);buttongroup.add(jradiobutton9);buttongroup.add(jradiobutton10);buttongroup.add(jradiobutton11);buttongroup.add(jradiobutton12);jLabel1.setBounds(new Rectangle(21,17,64,24));jLabel2.setBounds(new Rectangle(21,63,53,22));jradiobutton1.setBounds(new Rectangle(21,138,40,20));jradiobutton2.setBounds(new Rectangle(64,138,40,20));jradiobutton3.setBounds(new Rectangle(107,138,40,20));jradiobutton4.setBounds(new Rectangle(150,138,40,20));jradiobutton5.setBounds(new Rectangle(193,138,40,20));jradiobutton6.setBounds(new Rectangle(236,138,40,20));jradiobutton7.setBounds(new Rectangle(21,160,40,20));jradiobutton8.setBounds(new Rectangle(64,160,40,20));jradiobutton9.setBounds(new Rectangle(107,160,40,20));jradiobutton10.setBounds(new Rectangle(150,160,40,20));jradiobutton11.setBounds(new Rectangle(193,160,55,20));jradiobutton12.setBounds(new Rectangle(250,160,55,20));jLabel3.setBounds(21,105,64,24);jTextField1.setBounds(new Rectangle(102,10,120,30));jTextField2.setBounds(new Rectangle(102,60,120,30));jButton1.setBounds(new Rectangle(102,200,100,32));jButton1.addActionListener(this);this.add(jradiobutton1);this.add(jradiobutton2);this.add(jradiobutton3);this.add(jradiobutton4);this.add(jradiobutton5);this.add(jradiobutton6);this.add(jradiobutton7);this.add(jradiobutton8);this.add(jradiobutton9);this.add(jradiobutton10);this.add(jradiobutton11);this.add(jradiobutton12);this.add(jLabel1);this.add(jTextField1);this.add(jLabel2);this.add(jTextField2);this.add(jLabel3);this.add(jButton1);}public void actionPerformed(ActionEvent e){String EmployeeID=jTextField1.getText();String EmployeeSalary=jTextField2.getText();if(EmployeeID.equals("")|EmployeeSalary.equals("")){JOptionPane.showMessageDialog(this, "内容不允许为空");}else{try{if(jradiobutton1.isSelected())month="insert into January(employeeid,January) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton2.isSelected())month="insert into February(employeeid,February) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton3.isSelected())month="insert into March(employeeid,March) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton4.isSelected())month="insert into April(employeeid,April) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton5.isSelected())month="insert into May(employeeid,May) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton6.isSelected())month="insert into June(employeeid,June) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton7.isSelected())month="Julyinsert into July(employeeid,July) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton8.isSelected())month="Augustinsert into August(employeeid,August) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton9.isSelected())month="insert into September(employeeid,September) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton10.isSelected())month="insert into October(employeeid,October) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton11.isSelected())month="insert into November(employeeid,November) values('"+EmployeeID+"','"+EmployeeSalary+"')";else if(jradiobutton12.isSelected())month="insert into December(employeeid,December) values('"+EmployeeID+"','"+EmployeeSalary+"')";st.executeUpdate(month);JOptionPane.showMessageDialog(this,"工资添加成功!");。

c++课程设计-教师工资管理系统-源代码

c++课程设计-教师工资管理系统-源代码

c++课程设计-教师工资管理系统-源代码教师工资管理系统源代码本文件包括四个文件, 下载后请自行分开, 每个文件由////分开, ////后面即是要保存的文件名。

本系统, 包括添加, 修改, 删除, 查询, 显示。

教师信息保存到文件。

有帮助系统, 更改字体和背景颜色功能。

还有, 本程序只需编译连接main.Cpp 不要把另外三个文件添加到工程, 否则会出现连接出错! ! ! ! ! ( 可是四个文件都要放在同一目录下, 因为都要用的。

会自动加在External dependencies 里面)////main.cpp#include"Chen.cpp"#include"Liao.cpp"#include<iostream>using namespace std;Function t[100];int count;Liao abc1;Chen abc2;void colorme();void help();void menu() //菜单{char c[60]="\t\t\t\t 欢迎使用 ! ";char b[100]="\t Welcome to use the teachers' salary management system !";system("color fd");cout<<"\n\n\n\n"<<endl;cout<<"\t\t\t"<<" 教师工资管理系统\n\n\n"<<endl;cout<<"\t\t\t 制作人: 陈伟廖亚斌"<<endl<<endl;cout<<"\t\t\t学号: 08408 10 08408 09\n\n"<<endl;cout<<"\t\t\t\t 12月\n\n\n\t\t\t"<<endl;for(int i=0;i<=20;i++){cout<<c[i];_sleep(40); //延时}cout<<"\n\n";for(i=0;i<=58;i++){cout<<b[i];_sleep(30); //延时}_sleep(1000);system("cls");while(1){fflush(stdin); //清除输入流缓冲区system("cls");cout<<"\n\n\n\n"<<endl;cout<<"\t\t\t\t教师工资管理系统\n\n\n";cout<<"\t\t\t1.添加教师信息 2.修改教师信息"<<endl<<endl;cout<<"\t\t\t3.删除教师信息 4.查询教师信息"<<endl<<endl;cout<<"\t\t\t5.显示教师信息 6.系统帮助信息"<<endl<<endl;cout<<"\t\t\t9.更改皮肤颜色0.退出信息系统\n\n\n"<<endl;cout<<"\t\t\t请选择: ";char a[10];gets(a);switch(a[0]){case '1':abc1.add();break;case '2':abc1.alter();break;case '3':abc2.del();break;case '4':abc2.inquiry();break;case '5':abc2.display();break;case '6':help();break;case '9':colorme();break;case '0':cout<<"\n\t\t\t谢谢使用! \n\n\t\t\t";exit(0);break;。

c语言教师工资管理系统

c语言教师工资管理系统

c语言教师工资管理系统C语言程序设计课程设计报告设计题目:教师工资管理系统级班学号姓名指导教师起止时间 2010-10-26 至 2010-12-261设计任务该系统包含教师的基本信息,供读者查询。

建立一个文件,包括老师的信息,包括:教师号、姓名、性别、单位名称、家庭住址、联系电话、基本工资、津贴、生活补贴、应发工资、电话费、水电费、房租、所得税、卫生费、公积金等。

读者可以输入教师信息、插入教师信息、删除教师信息、浏览教师信息、查询教师信息和修改教师信息。

同时读者可以将之前录入的教师信息保存下来,然后关闭程序后,再次打开后只需加载教师信息就可以了。

更加方便以后程序。

评语(教师填写)1目录设计任务 ..................................................................... . (2)评语(教师填写) .................................................................... ................................................... 2 1.课程设计目的 ..................................................................... .. (4)2.课程设计题目 (5)3.功能描述 ..................................................................... . (6)4.数据结构设计 ..................................................................... .................................................. 8 5.功能模块设计 ..................................................................... (10)5.1主控模块设计 ..................................................................... (10)5.2 输入记录模块 ..................................................................... (11)5.3 插入记录模块 ..................................................................... (11)5.4 删除记录模块 ..................................................................... ................................... 12 6.函数功能描述 ..................................................................... (13)6.1 保存数据函数save() ................................................................. .. (13)6.2 查询数据函数query() ................................................................ . (13)6.1修改数据函数edit() ................................................................. (14)6.1 加载数据函数load() ................................................................. .. (15)7.运行结果 ..................................................................... . (112)7.1系统主界面 ..................................................................... (112)7.2 输入教师信息界面 (16)7.3 输出教师信息界面...................................................................... (18)7.4 插入教师信息界面 (19)7.5 保存和加载教师信息界面 (20)8.个人设计小结与心得体会 ..................................................................... . (21)参考文献 ..................................................................... .. (22)11.课程设计目的本程序旨在训练基本编程能力,了解管理信息系统的开发流程,熟悉C语言的文件和结构数组的各种基本操作。

教师绩效考核系统源码

教师绩效考核系统源码

教师绩效考核系统源码通常涉及多个文件和模块,但我可以为您提供一个简化的教师绩效考核系统的伪代码示例,以帮助您理解其结构和功能。

请注意,这只是一个示例,实际源码可能会根据具体需求和编程语言而有所不同。

```python# 教师绩效考核系统伪代码class Teacher:def __init__(self, name, subject, teaching_experience): = nameself.subject = subjectself.teaching_experience = teaching_experienceclass PerformanceSystem:def __init__(self):self.teachers = []def add_teacher(self, teacher):self.teachers.append(teacher)def calculate_performance(self, criteria):for teacher in self.teachers:score = 0for criterion in criteria:if criterion == "teaching_experience": score += teacher.teaching_experience * 0.5elif criterion == "student_feedback":score += self.get_student_feedback(teacher) * 0.3elif criterion == "course_evaluation": score += self.get_course_evaluation(teacher) * 0.2teacher.performance = scoreprint(f"Teacher {} has a performance score of {teacher.performance}")def get_student_feedback(self, teacher):feedback = input(f"Enter student feedback for {}: ")return float(feedback) # Convert feedback to anumber for calculationdef get_course_evaluation(self, teacher):evaluation = input(f"Enter course evaluation for {}: ")return float(evaluation) # Convert evaluation to a number for calculation# 示例用法performance_system = PerformanceSystem()teacher1 = Teacher("John Smith", "Math", 5) # 假设John Smith有5年的教学经验,教授数学科目teacher2 = Teacher("Jane Doe", "English", 3) # 假设Jane Doe有3年的教学经验,教授英语科目performance_system.add_teacher(teacher1)performance_system.add_teacher(teacher2)performance_system.calculate_performance(["teaching_exp erience", "student_feedback", "course_evaluation"]) ```这个示例展示了如何使用伪代码创建一个简单的教师绩效考核系统。

C语言课程设计职工工资信息管理系统源代码

C语言课程设计职工工资信息管理系统源代码

#include <stdio.h>#include <string.h>#include <stdlib.h>#include <conio.h>#define N 10000int choice;struct employee{int num;int position;char name[10000];char sex[2];int salary;int i,max,t;}em[N];struct empsalary{char name[10000];int salary;}emps[N];void manage();void query();void input();void display();void change();void del();void add();void paixu();int changeposition();int changesalary();void querysalary();void creat();void main(){do{printf("欢迎进入职工管理系统中文版\n"); printf("请你选择操作类型:\n");printf("1进入管理系统\n");printf("2进入查询系统\n");printf("0退出系统\n");scanf("%d",&choice);switch(choice){case 1:manage();break;case 2:query();break;case 0:{printf("谢谢使用,再见\n");exit(0);}default:{printf("输入有错误请重新输入:\n");return;}}}while(1);}void manage(){int choicemanage;char choice='y';while(choice=='y'||choice=='Y'){printf("欢迎进入管理系统\n");printf("请你选择操作类型:\n");printf("1输入职工信息\n");printf("2显示职工信息\n");printf("3修改职工信息\n");printf("4追加一个职工信息\n");printf("5删除一个职工信息\n");printf("6排序\n");printf("0返回\n");scanf("%d",&choicemanage);switch(choicemanage){case 1:input();break;case 2:display();break;case 3:change();break;case 4:add();break;case 5:del();case 6:paixu();break;case 0:printf("谢谢你的使用再见\n");return;default:printf("你的输入有错请重新输入\n"); }printf("是否继续管理?(y/n)");scanf("%s",&choice);}if(toupper(choice)=='N'||(choice)=='n'){printf("输入完毕,任意键返回\n");getch();return;}}void input(){FILE *fp;int i=0;char choiceinput='y';if((fp=fopen("employee.txt","w"))==NULL) return;while(choiceinput=='y'||choiceinput=='Y'){i++;printf("第%d个职工\n",i);printf("\n");printf("请你输入工号:\n");scanf("%d",&em[i].num);printf("\n");printf("请你输入职位:\n");printf("1董事长2总经理3副总经理\n");printf("4经理5副经理6秘书\n");printf("7技术员8领班9员工\n");scanf("%d",&em[i].position);printf("\n");printf("请你输入姓名:\n");scanf("%s",em[i].name);printf("\n");printf("请你输入性别以m为男f为女:\n");scanf("%s",em[i].sex);printf("\n");printf("请你输入工资:\n");scanf("%d",&em[i].salary);printf("\n");printf("是否继续输入?(y/n)\n");scanf("%s",&choiceinput);fwrite(&em[i],sizeof(struct employee),1,fp);}if(toupper(choiceinput)=='N'){fclose(fp);printf("输入完毕,任意键返回\n");getch();return;}}void display(){FILE *fp;int i;if((fp=fopen("employee.txt","r"))==NULL)return;printf("输出结果:\n");for(i=0;fread(&em[i],sizeof(struct employee),1,fp)!=0;i++) {printf("工号%d\n",em[i].num);printf("职位为%d\n",em[i].position);printf("1董事长2总经理3副总经理\n");printf("4经理5副经理6秘书\n");printf("7技术员8领班9员工\n");printf("姓名为%s\n",em[i].name);printf("性别为%s\n",em[i].sex);printf("其中m为男f为女\n");printf("工资为%d\n",em[i].salary);}printf("完毕按任意键返回\n");getch();fclose(fp);return;}void change(){FILE *fp;int i;char chname[8];int choicechange;printf("请你输入要修改的人的姓名:\n");scanf("%s",&chname);if((fp=fopen("employee.txt","w+"))==NULL){printf("不能够打开这个文件\n");return;}for(i=0;i<N;i++){if(strcmp(chname,em[i].name)==0){printf("这是你要修改的人的信息\n");printf("工号为%d\n 职位为%d\n 姓名为%s\n 性别为%s\n 工资为%d\n",em[i].num,em[i].position,em[i].name,em[i].sex,em[i].salary);printf("请你输入要修改的部分:\n");printf("1修改职位\n");printf("2修改工资\n");printf("0退出系统\n");printf("请选择\n");scanf("%d",&choicechange);switch(choicechange){case 1:em[i].position=changeposition();break;case 2:em[i].salary=changesalary();break;case 0:return;default :printf("输入有错误");}fwrite(&em[i],sizeof(struct employee),1,fp); }}fclose(fp);printf("操作完成按任意键返回\n");getch();return;}int changeposition(){int newposition;printf("请你输入新职位:\n");printf("1董事长2总经理3副总经理\n"); printf("4经理5副经理6秘书\n"); printf("7技术员8领班9员工\n"); scanf("%d",&newposition);return(newposition);}int changesalary(){int newsalary;printf("请你输入新的工资:\n");scanf("%d",&newsalary);return(newsalary);}void add(){struct employee emp;FILE *fp;int i=0;if((fp=fopen("employee.txt","ab+"))==NULL){printf("不能够打开这个文件\n");getch();return;}printf("请你输入新人的内容:\n");printf("请你输入工号:\n");scanf("%d",&em[i].num);printf("请你输入职位:\n");printf("1董事长2总经理3副总经理\n");printf("4经理5副经理6秘书\n");printf("7技术员8领班9员工\n");scanf("%d",&emp.position);printf("请你输入姓名:\n");scanf("%s",);printf("请你输入性别以m为男f为女:\n");scanf("%s",emp.sex);printf("请你输入工资:\n");scanf("%d",&emp.salary);fwrite(&emp,sizeof(struct employee),1,fp);rewind(fp);printf("插入完毕,按任意键返回\n");getch();fclose(fp);return;}void del(){int i=0;char delname[8];FILE *fp;if((fp=fopen("employee.txt","w"))==NULL){printf("文件为空,不能够打开\n");printf("按任意键返回\n");getch();return;}printf("请你输入要删除的人的姓名:\n");scanf("%s",delname);for(i=0;fread(&em[i],sizeof(struct employee),1,fp)!=0;i++) {if(strcmp(em[i].name,delname)!=0)fwrite(&em[i],sizeof(struct employee),1,fp);}fclose(fp);if((fp=fopen("employee.txt","r"))==NULL)return;printf("新的职工的信息为:\n");for(i=0;fread(&em[i],sizeof(struct employee),1,fp)!=0;i++) {printf("工号%d",em[i].num);printf("职位为%d",em[i].position);printf("1董事长2总经理3副总经理\n");printf("4经理5副经理6秘书\n");printf("7技术员8领班9员工\n");printf("姓名为%s\n",em[i].name[8]);printf("性别为%s\n",em[i].sex[2]);printf("其中m为男f为女\n");printf("工资为%d\n",em[i].salary);fclose(fp);}}void query(){FILE *fp;int i=0;char quename[8];if((fp=fopen("employee.txt","r"))==NULL){printf("不能够打开文件,按任意键返回\n");getch();return;}printf("请你输入要查询的人的姓名\n");scanf("%s",quename);for(i=0;fread(&em[i],sizeof(struct employee),1,fp)!=0;i++) {if(strcmp(em[i].name,quename)==0){printf("\t\t\n查询到的职工号或姓名为的信息如下:\n");printf("以下是你要查询的人的信息\n");printf("工号%d",em[i].num);printf("职位为%d",em[i].position);printf("\t 1董事长2总经理3副总经理\n");printf("\t 4经理5副经理6秘书\n");printf("\t 7技术员8领班9员工\n");printf("姓名为%s\n",em[i].name);printf("性别为%s\n",em[i].sex);printf("\t其中m为男f为女\n");printf("工资为%d\n",em[i].salary);printf("\n");printf("查询完毕,按任意键返回\n");getch();fclose(fp);return;}}printf("没有这样的人,按任意键返回\n");getch();fclose(fp);return;}void querysalary(){int i;FILE *fp1,*fp2;creat();if((fp1=fopen("employee.txt","w+"))==NULL)return;for(i=0;fread(&em[i],sizeof(struct employee),1,fp1)!=0;i++) {printf("输出结果为:\n");printf("工号%d",em[i].num);printf("职位为%d",em[i].position);printf(" 1董事长2总经理3副总经理\n");printf(" 4经理5副经理6秘书\n");printf(" 7技术员8领班9员工\n");printf("姓名为%s\n",em[i].name[8]);printf("性别为%s\n",em[i].sex[2]);printf("其中m为男f为女\n");printf("工资为%d\n",em[i].salary);strcpy(emps[i].name,em[i].name);emps[i].salary=em[i].salary;}if((fp2=fopen("empsalary.txt","w"))==NULL)return;for(i=0;i<N;i++)fwrite(&emps[i],sizeof(struct empsalary),1,fp2);fclose(fp1);fclose(fp2);}void creat(){FILE *fp;if((fp=fopen("D:\\employee.txt","w+"))==NULL)return;input();fclose(fp);}void paixu(){int max,i,t,j;for(i=1;i<10;i++){max=em[i].salary;for(j=i;j<10;j++){if(em[j].salary>max){max=em[j].salary;t=em[j].salary;em[j].salary=t;}}}printf("姓名工资工号性别职位\n");for(i=1;i<10;i++)printf(" %s %d %d %s %d\n ",em[i].name,em[i].salary,em[i].num,em[i].sex,em[i].position);}。

教师工资管理系统C语言汇编

教师工资管理系统C语言汇编

教师工资管理系统C语言#include<stdio.h>#include<conio.h>#include<stdlib.h>#include<string.h>typedef struct teacher{char name[32];char unit[32];char sex[4];char address[32];long number,phone;float salary,allowance,tax,call,waterandele,rent,clean,gong,koukuan,total;struct teacher *next;}TEACHER; //节点的结构体,包含数据和指针.TEACHER *head;//头节点void init() //初始化头节点并从文件中读取数据存入链表{head=(TEACHER *)malloc(sizeof(TEACHER));head->next=NULL;FILE *f_p;if((f_p = fopen("teacher.txt","a+")) != NULL){fseek(f_p,0L,SEEK_END);int len = ftell(f_p);rewind(f_p);while(len!=0&&!feof(f_p)){TEACHER *node=(TEACHER *)malloc(sizeof(TEACHER));fscanf(f_p,"%s%s%s%s%ld%ld",node->name,node->sex,node->unit,node->address,&node-> number,&node->phone);fscanf(f_p,"%f%f%f%f",&node->salary,&node->allowance,&node->tax,&node->call);fscanf(f_p,"%f%f%f%f%f%f",&node->waterandele,&node->rent,&node->clean,&node->gong ,&node->koukuan,&node->total);node->next = head->next;head->next = node;}}fclose(f_p);}TEACHER *search(char *s) //遍历整个链表并打印数据{TEACHER *nod=head->next;//把头节点赋值给nod节点while(nod != NULL)//循环到最后一个节点{if((!strcmp(nod->name,s)) || (!strcmp(nod->unit,s))){printf("姓名:%s\n性别: %s\n单位:%s\n家庭住址:%s\n教师号:%ld\n电话号:%ld\n",nod->name,nod->sex,nod->unit,nod->address,nod->number,nod->phone);printf("基本工资:%.2f\n津贴:%.2f\n扣税:%.2f\n话费:%.2f\n",nod->salary,nod->allowance,nod->tax,nod->call);printf("水电费:%.2f\n房租:%.2f\n卫生费:%.2f\n公积金:%.2f\n",nod->waterandele,nod->rent,nod->clean,nod->gong);printf("合计扣款:%.2f\n实发工资:%.2f\n",nod->koukuan,nod->total);return nod;//返回到第一个nod节点}else nod = nod->next;//跳出循环}printf("未找到数据!\n");return NULL;}int addmenu()//添加教师信息子菜单{TEACHER *node;char command;system("cls");printf("****************************\n");printf("* 添加子菜单*\n");printf("****************************\n");printf("* 功能:4.返回主菜单5.添加*\n");printf("* 请选择需要使用的功能: *\n");printf("****************************\n");fflush(stdin);while((command=getchar())!='4'){printf("添加信息:\n");node=(TEACHER *)malloc(sizeof(TEACHER));fflush(stdin);printf("姓名:");fflush(stdin);gets(node->name);printf("性别:");gets(node->sex);fflush(stdin);printf("单位:");fflush(stdin);gets(node->unit);printf("家庭住址:");gets(node->address);fflush(stdin);printf("教师号:");fflush(stdin);scanf("%ld",&node->number);printf("电话号码:");scanf("%ld",&node->phone);fflush(stdin);printf("基本工资:");scanf("%f",&node->salary);fflush(stdin);printf("津贴:");scanf("%f",&node->allowance);fflush(stdin);printf("扣税:");scanf("%f",&node->tax);fflush(stdin);printf("话费:");scanf("%f",&node->call);fflush(stdin);printf("水电费:");scanf("%f",&node->waterandele);fflush(stdin);printf("房租:");scanf("%f",&node->rent);fflush(stdin);printf("卫生费:");scanf("%f",&node->clean);fflush(stdin);printf("公积金:");scanf("%f",&node->gong);fflush(stdin);node->koukuan = node->tax + node->call + node->waterandele + node->rent + node->clean + node->gong;node->total = node->salary + node->allowance - node->koukuan;node->next = head->next;head->next = node;printf("输入c退出,其他字符继续\n");if((command=getchar())=='c')break;}return 0;}bool save()//保存教师信息函数{TEACHER *nod = head->next;FILE *fp;//定义文件指针if((fp=fopen("teacher.txt","w")) == NULL){printf("打开文件异常\n");return false;}elsewhile(nod != NULL)//打开teacher这个文件并写入信息{fprintf(fp,"%s %s %s %s %ld %ld ",nod->name,nod->sex,nod->unit,nod->address,nod->number,nod->phone);fprintf(fp,"%.2f %.2f %.2f %.2f ",nod->salary,nod->allowance,nod->tax,nod->call);fprintf(fp,"%.2f %.2f %.2f %.2f %.2f %.2f",nod->waterandele,nod->rent,nod->clean,nod->gon g,nod->koukuan,nod->total);if(nod->next!=NULL)fprintf(fp,"\n");nod = nod->next;}fclose(fp);return true;}bool modify()//修改教师信息函数{char name[16];printf("请输入需修改教师的姓名:");scanf("%s",name);TEACHER *nod=head->next;while(nod != NULL){if(!strcmp(nod->name,name)){printf("请输入新信息:\n");printf("姓名:");fflush(stdin);gets(nod->name);printf("性别:");gets(nod->sex);fflush(stdin);printf("单位:");fflush(stdin);gets(nod->unit);printf("家庭住址:");fflush(stdin);gets(nod->address);printf("教师号:");fflush(stdin);scanf("%ld",&nod->number);printf("电话号码:");fflush(stdin);scanf("%ld",&nod->phone);printf("基本工资:");scanf("%f",&nod->salary);fflush(stdin);printf("津贴:");scanf("%f",&nod->allowance);fflush(stdin);printf("扣税:");scanf("%f",&nod->tax);fflush(stdin);printf("话费:");scanf("%f",&nod->call);fflush(stdin);printf("水电费:");scanf("%f",&nod->waterandele);fflush(stdin);printf("房租:");scanf("%f",&nod->rent);fflush(stdin);printf("卫生费:");scanf("%f",&nod->clean);fflush(stdin);printf("公积金:");scanf("%f",&nod->gong);fflush(stdin);nod->koukuan = nod->tax + nod->call + nod->waterandele + nod->rent + nod->clean + nod->gong;nod->total = nod->salary + nod->allowance - nod->koukuan;return true;}nod = nod->next;}return false;}bool Delete()//删除教师信息函数{char name[16];printf("请输入需删除教师的姓名:");scanf("%s",name);fflush(stdin);TEACHER *delete_nod = head;while(delete_nod->next){if(!strcmp(delete_nod->next->name,name)){TEACHER *wait_delete_nod = delete_nod->next;delete_nod->next = wait_delete_nod->next;free(wait_delete_nod);return true;}delete_nod = delete_nod->next;}return false;}int searchmenu()//查寻教师信息菜单{char name[16];char command;system("cls");printf("|-----------------------------------------------------|\n");printf("| 查询和修改子菜单|\n");printf("|-----------------------------------------------------|\n");printf("|功能:4.返回主菜单5.通过姓名/单位查找6.修改7.删除|\n");printf("|-----------------------------------------------------|\n");fflush(stdin);printf("请输入需要实现的操作:");while((command=getchar()) !='4'){switch(command){case '5':printf("请输入需要查找的姓名/单位:");fflush(stdin);gets(name);fflush(stdin);search(name);break;case '6':if(modify())printf("修改成功!\n");elseprintf("未查询到该教师!请重试...\n");break;case '7':if(Delete())printf("删除成功!\n");elseprintf("未查询到该教师!请重试...\n");break;}fflush(stdin);printf("请输入需要实现的操作:");}return 0;}int menu()//系统欢迎界面{char command;system("cls");printf("*------------------------------------*\n");printf("* 欢迎进入教师工资管理系统*\n");printf("*------------------------------------*\n");printf("*功能:1.添加2.查询/修改3.保存4.退出\n");printf("*------------------------------------*\n");printf("* 本系统由XXX所编*\n");printf("*------------------------------------*\n");printf(" 请输入需要实现的操作: \n");while((command=getchar())!='4'){switch(command){case '1': addmenu(); break;case '2': searchmenu();break;case '3':bool judge=save();if(judge)printf("保存成功!\n");elseprintf("保存失败!\n");break;}printf("请按任意键返回...\n");getch();fflush(stdin);/*子函数退出后再次显示主界面*/system("cls");printf("|-------------------------------------|\n");printf("| 教师工资管理系统|\n");printf("|-------------------------------------|\n");printf("|功能:1.添加2.查询/修改3.保存4.退出|\n");printf("|-------------------------------------|\n");printf("| 请输入需要实现的操作: |\n");printf("|-------------------------------------|\n");}printf("| 感谢您使用本系统|\n");return 0;}int main(){init();menu();return 0; }。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

#include <stdio.h>#include <stdlib.h>#include <string.h>#include <conio.h>#define LEN sizeof(struct teacher)struct teacher{int num;char name[20];char sex[20];char workplace[50];char address[50];long phone;double de_salary;double de_jintie;double de_shenghuobutie;double yingfa_salary;double cost_phone;double cost_water_elec;double cost_rent;double cost_tax;double cost_weisheng;double cost_gongjijin;double cost_all;double shifa_salary;struct teacher *next;};/***********************************读取函数************************************/ struct teacher *load(){struct teacher *p1,*p2,*head;FILE *fp;int i=1;if((fp=fopen("save","rb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();return (NULL);}else{head=NULL;p1=(struct teacher *)malloc(LEN);while (fread(p1,LEN-4,1,fp)==1){if(i==1){head=p1;p2=p1;i=2;}else{p2->next=p1;p2=p2->next;}p1=(struct teacher *)malloc(LEN);}p2->next=NULL;free(p1);fclose(fp);return(head);}}/**********************************欢迎菜单函数*************************************/void welcome(){printf("\n\n\n >>>>>欢迎使用教师工资管理系统Beta1.0<<<<< \n");printf(" *******************************************************\n");printf(" \n");printf(" * C语言课程设计教师工资管理系统*\n");printf(" \n");printf(" * 班级:0814112 *\n");printf(" *******************************************************\n");printf("\n\n 按下任意键进入系统...");getch();system("cls");}/**********************************制作人员名单*************************************/void list(){system("cls");printf("\n\n\n >>>>>版权所有侵权必究<<<<<\n");printf("*******************************************************************************\n");printf("* 学校(College): 河南城建学院*\n");printf("* 软件名称(Software):教师工资管理系统Teacher's Salary Managing System *\n");printf("* 版本号(Edition): Beta1.0 *\n");printf("* 所在班级(Class):计算机科学与技术*\n");printf("* 所在系别(Institute):计算机科学与工程系*\n");printf("*******************************************************************************\n");printf(" >>>>>ILLEGAL COPY BANNED<<<<<\n");printf("\n\n 按下任意键返回主菜单...");getch();}/***********************************菜单函数*****************************************/int menu(){int i;printf("\n\n\n >>>>>欢迎使用教师工资管理系统Beta1.2<<<<<\n");printf(" *******************************************************\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(" 请输入你想要的操作:");scanf("%d",&i);getchar();return i;}/***********************************插入函数*****************************************/void input(){struct teacher *head,*p1,*p2,*p3,*px;int i,t;FILE *fp;char k,n='n',num[30],name[20];p1=p2=p3=px=(struct teacher *)malloc(LEN);if((head=load())!=NULL){do{n='n';printf(" 请输入要插入的教师信息:\n");printf(" ------------------------------\n");printf(" 请输入教工号:");gets(num);px->num=atoi(num);printf(" 请输入姓名:");gets(px->name);printf(" 请输入性别:");gets(px->sex);printf(" 请输入单位名称:");gets(px->workplace);printf(" 请输入家庭住址:");gets(px->address);printf(" 请输入联系电话:");gets(num);px->phone=atoi(num);printf(" 请输入基本工资:");gets(num);px->de_salary=atof(num);printf(" 请输入津贴:");gets(num);px->de_jintie=atof(num);printf(" 请输入生活补贴:");gets(num);px->de_shenghuobutie=atof(num);printf(" 请输入电话费:");gets(num);px->cost_phone=atof(num);printf(" 请输入水电费:");gets(num);px->cost_water_elec=atof(num);printf(" 请输入房租:");gets(num);px->cost_rent=atof(num);printf(" 请输入个人所得税:");gets(num);px->cost_tax=atof(num);printf(" 请输入卫生费:");gets(num);px->cost_weisheng=atof(num);printf(" 请输入公积金:");gets(num);px->cost_gongjijin=atof(num);px->yingfa_salary=px->de_salary+px->de_jintie+px->de_shenghuobutie;px->cost_all=px->cost_phone+px->cost_water_elec+px->cost_rent+px->cost_tax+px->cost_weisheng+px->cost_go ngjijin;px->shifa_salary=px->yingfa_salary-px->cost_all;printf(" 数据输入完毕,按下任意键继续...");getch();system("cls");printf("\n\n\n >>>>>>>>>>> 插入教师信息<<<<<<<<<<<\n");printf(" *******************************************************\n");printf(" * 1.输入教师号*\n");printf(" * 2.输入姓名*\n");printf(" * 3.返回上级菜单*\n");printf(" *******************************************************\n");printf(" 请选择插入方式:");scanf("%d",&i);getchar();while (i<1||i>3){printf(" 输入有误!请重新输入:");scanf("%d",&i);getchar();}switch(i){case 1:printf(" 请输入要插入在哪条数据后面:");scanf("%d",&t);getchar();p1=head;while (p1->num!=t){if (p1->next!=NULL){ p1=p1->next;}else{printf(" 查找不到相关数据!\n");break;}}if (p1->num==t){printf("-----------------------------要插入的信息如下:--------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",px->num,px->name,px->sex,px->workplace,px->address,px ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf\n",px->cost_phone,px->cost_water_ele c,px->cost_rent,px->cost_tax,px->cost_weisheng,px->cost_gongjijin,px->cost_all);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",px->de_salary,px->de_jintie,px->de_shenghuobutie,px->yingfa_salary,px->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" 确定插入吗?(y或n):");scanf("%c",&k);getchar();}if (k=='y'||k=='Y'){if (p1->num==t){if(p1==head)/*如果插入点为头指针*/{p3=p1->next;p1->next=px;px->next=p3;p2=head;}else if(p1->next==NULL)/*如果插入点为末尾指针*/{p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1=p1->next;p1->next=px;px->next=NULL;}else{/*如果插入点为中间指针*/p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1=p1->next;p3=p1->next;px->next=p3;p1->next=px;}if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{do{fwrite(p2,LEN-4,1,fp);if(p2->next!=NULL)p2=p2->next;}while(p2->next!=NULL);if(p2!=head)fwrite(p2,LEN-4,1,fp);}fclose(fp);printf(" 插入成功!按下任意键继续...");getch();}}else {printf(" 插入已被取消!按下任意键继续...");getch();}break;case 2:printf(" 请输入要插入的教师姓名:");gets(name);p1=head;while (strcmp((p1->name),name)!=0){if (p1->next!=NULL)p1=p1->next;else{printf(" 查找不到相关数据!\n");break;}}if (strcmp((p1->name),name)==0){printf("-----------------------------要插入的信息如下:--------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf \n",p1->cost_phone,p1->cost_water_elec,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_al l);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" 确定插入吗?(y或n):");scanf("%c",&k);getchar();}if (k=='y'||k=='Y'){if (strcmp((p1->name),name)==0){if(p1==head)/*如果插入点为头指针*/{p1->next=px;p2=head;}else if(p1->next==NULL)/*如果插入点为末尾指针*/{p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1=p1->next;p1->next=px;px->next=NULL;}else{/*如果插入点为中间指针*/p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1=p1->next;p1->next=px;p3=p3->next;px->next=p3;}if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{do{fwrite(p2,LEN-4,1,fp);if(p2->next!=NULL)p2=p2->next;}while(p2->next!=NULL);if(p2!=head)fwrite(p2,LEN-4,1,fp);}fclose(fp);printf(" 插入成功!按下任意键继续...");getch();}}else {printf(" 插入已被取消!按下任意键继续...");getch();}break;case 3:break;default :break;}if (i!=3){printf("\n 继续插入其他教师的信息吗?(y或n)");scanf("%c",&n);getchar();}}while((n=='y'||n=='Y')&&i!=3);}printf(" 数据插入成功!按下任意键返回主菜单...");getch();getchar();}/***********************************输入函数*****************************************/ void insert(){FILE *fp;char m,num[30];struct teacher *p1;p1=(struct teacher *)malloc(LEN);if((fp=fopen("save","ab"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{printf(" 请输入教师信息:\n");do{printf(" ------------------------------\n");printf(" 请输入教工号:");gets(num);p1->num=atoi(num);printf(" 请输入姓名:");gets(p1->name);printf(" 请输入性别:");gets(p1->sex);printf(" 请输入单位名称:");gets(p1->workplace);printf(" 请输入家庭住址:");gets(p1->address);printf(" 请输入联系电话:");gets(num);p1->phone=atoi(num);printf(" 请输入基本工资:");gets(num);p1->de_salary=atof(num);printf(" 请输入津贴:");gets(num);p1->de_jintie=atof(num);printf(" 请输入生活补贴:");gets(num);p1->de_shenghuobutie=atof(num);printf(" 请输入电话费:");gets(num);p1->cost_phone=atof(num);printf(" 请输入水电费:");gets(num);p1->cost_water_elec=atof(num);printf(" 请输入房租:");gets(num);p1->cost_rent=atof(num);printf(" 请输入个人所得税:");gets(num);p1->cost_tax=atof(num);printf(" 请输入卫生费:");gets(num);p1->cost_weisheng=atof(num);printf(" 请输入公积金:");gets(num);p1->cost_gongjijin=atof(num);p1->yingfa_salary=p1->de_salary+p1->de_jintie+p1->de_shenghuobutie;p1->cost_all=p1->cost_phone+p1->cost_water_elec+p1->cost_rent+p1->cost_tax+p1->cost_weisheng+p1->cost_go ngjijin;p1->shifa_salary=p1->yingfa_salary-p1->cost_all;fwrite(p1,LEN-4,1,fp);printf(" 输入下一个?(y或n)");m=getchar();if(m!='y'&&m!='Y'){printf(" 数据保存成功!按下任意键返回主菜单...");getch();}getchar();}while (m=='y'||m=='Y');}fclose(fp);}/***********************************修改函数*****************************************/ void modify(){struct teacher *head,*p1,*p2;int i;FILE *fp;char m='n',n='n',num2[30];p1=head=(struct teacher *)malloc(LEN);if((head=load())!=NULL){do{int num=0;char name[20];p1=head;system("cls");printf("\n\n\n >>>>>>>>>>> 修改教师信息<<<<<<<<<<<\n");printf(" *******************************************************\n");printf(" * 1.输入教师号*\n");printf(" * 2.输入姓名*\n");printf(" * 3.返回上级菜单*\n");printf(" *******************************************************\n");printf(" 请选择修改方式:");scanf("%d",&i);getchar();while (i<1||i>3){printf(" 输入有误!请重新输入:");scanf("%d",&i);getchar();}switch(i){case 1:printf(" 请输入要修改的教师号:");scanf("%d",&num);getchar();while (p1->num!=num){if (p1->next!=NULL)p1=p1->next;else{printf(" 查找不到相关数据!\n");break;}}if (p1->num==num){system("cls");printf("\n\n\n >>>>>欢迎使用教师工资管理系统Beta1.2<<<<<\n");printf("----------------------------------原信息如下:---------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf\n",p1->cost_phone,p1->cost_water_ele c,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_all);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" *******************************************************\n");printf(" * 1.教师号 2.姓名*\n");printf(" * 3.性别 4.单位名称*\n");printf(" * 5.家庭住址 6.联系电话*\n");printf(" * 7.基本工资8.津贴*\n");printf(" * 9.生活补贴10.电话费*\n");printf(" * 11.水电费12.房租*\n");printf(" * 13.所得税14.卫生费*\n");printf(" * 15.公积金*\n");printf(" *******************************************************\n");do{printf(" 请选择要修改的数据:");scanf("%d",&i);getchar();while (i>15||i<1){printf(" 输入有误!请重新输入:");scanf("%d",&i);getchar();}switch(i){case 1:printf(" 请输入新教师号:");gets(num2);p1->num=atoi(num2);break;case 2:printf(" 请输入新姓名:");gets(p1->name);break;case 3:printf(" 请输入新性别:");gets(p1->sex);break;case 4:printf(" 请输入新单位名称:");gets(p1->workplace);break;case 5:printf(" 请输入新家庭住址:");gets(p1->address);break;case 6:printf(" 请输入新联系电话:");gets(num2);p1->phone=atoi(num2);break;case 7:printf(" 请输入新基本工资:");gets(num2);p1->de_salary=atof(num2);break;case 8:printf(" 请输入新津贴:");gets(num2);p1->de_jintie=atof(num2);break;case 9:printf(" 请输入新生活补贴:");gets(num2);p1->de_shenghuobutie=atof(num2);break;case 10:printf(" 请输入新电话费:");gets(num2);p1->cost_phone=atof(num2);break;case 11:printf(" 请输入新水电费:");gets(num2);p1->cost_water_elec=atof(num2);break;case 12:printf(" 请输入新房租:");gets(num2);p1->cost_rent=atof(num2);break;case 13:printf(" 请输入新所得税:");gets(num2);p1->cost_tax=atof(num2);break;case 14:printf(" 请输入新卫生费:");gets(num2);p1->cost_weisheng=atof(num2);break;case 15:printf(" 请输入新公积金:");gets(num2);p1->cost_gongjijin=atof(num2);break;default:break;}p1->yingfa_salary=p1->de_salary+p1->de_jintie+p1->de_shenghuobutie;p1->cost_all=p1->cost_phone+p1->cost_water_elec+p1->cost_rent+p1->cost_tax+p1->cost_weisheng+p1->cost_go ngjijin;p1->shifa_salary=p1->yingfa_salary-p1->cost_all;printf(" 继续修改其他数据吗?(y或n):");scanf("%c",&m);getchar();}while (m=='y'||m=='Y');p2=head;if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{fwrite(head,LEN-4,1,fp);do{p2=p2->next;fwrite(p2,LEN-4,1,fp);}while(p2->next!=NULL);printf("------------------------------修改后数据如下:---------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf \n",p1->cost_phone,p1->cost_water_elec,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_al l);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");}fclose(fp);}break;case 2:printf(" 请输入要修改的教师姓名:");gets(name);while (strcmp(p1->name,name)!=0){if (p1->next!=NULL)p1=p1->next;else{printf(" 查找不到相关数据!\n");break;}}if (strcmp(p1->name,name)==0){system("cls");printf("\n\n\n >>>>>欢迎使用教师工资管理系统Beta1.2<<<<<\n");printf("----------------------------------原信息如下:---------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf\n",p1->cost_phone,p1->cost_water_elec,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_al l);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" *******************************************************\n");printf(" * 1.教师号 2.姓名*\n");printf(" * 3.性别 4.单位名称*\n");printf(" * 5.家庭住址 6.联系电话*\n");printf(" * 7.基本工资8.津贴*\n");printf(" * 9.生活补贴10.电话费*\n");printf(" * 11.水电费12.房租*\n");printf(" * 13.所得税14.卫生费*\n");printf(" * 15.公积金*\n");printf(" *******************************************************\n");do{printf(" 请选择要修改的数据:");scanf("%d",&i);getchar();while (i>15||i<1){printf(" 输入有误!请重新输入:");scanf("%d",&i);getchar();}switch(i){case 1:printf(" 请输入新教师号:");gets(num2);p1->num=atoi(num2);break;case 2:printf(" 请输入新姓名:");gets(p1->name);break;case 3:printf(" 请输入新性别:");gets(p1->sex);break;case 4:printf(" 请输入新单位名称:");gets(p1->workplace);break;case 5:printf(" 请输入新家庭住址:");gets(p1->address);break;case 6:printf(" 请输入新联系电话:");gets(num2);p1->phone=atoi(num2);break;case 7:printf(" 请输入新基本工资:");gets(num2);p1->de_salary=atof(num2);break;case 8:printf(" 请输入新津贴:");gets(num2);p1->de_jintie=atof(num2);break;case 9:printf(" 请输入新生活补贴:");gets(num2);p1->de_shenghuobutie=atof(num2);break;case 10:printf(" 请输入新电话费:");gets(num2);p1->cost_phone=atof(num2);break;case 11:printf(" 请输入新水电费:");gets(num2);p1->cost_water_elec=atof(num2);break;case 12:printf(" 请输入新房租:");gets(num2);p1->cost_rent=atof(num2);break;case 13:printf(" 请输入新所得税:");gets(num2);p1->cost_tax=atof(num2);break;case 14:printf(" 请输入新卫生费:");gets(num2);p1->cost_weisheng=atof(num2);break;case 15:printf(" 请输入新公积金:");gets(num2);p1->cost_gongjijin=atof(num2);break;default:break;}p1->yingfa_salary=p1->de_salary+p1->de_jintie+p1->de_shenghuobutie;p1->cost_all=p1->cost_phone+p1->cost_water_elec+p1->cost_rent+p1->cost_tax+p1->cost_weisheng+p1->cost_go ngjijin;p1->shifa_salary=p1->yingfa_salary-p1->cost_all;printf(" 继续修改其他数据吗?(y或n):");scanf("%c",&m);getchar();}while (m=='y'||m=='Y');p2=head;if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{fwrite(head,LEN-4,1,fp);do{p2=p2->next;fwrite(p2,LEN-4,1,fp);}while(p2->next!=NULL);printf("------------------------------修改后数据如下:---------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf \n",p1->cost_phone,p1->cost_water_elec,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_al l);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");}fclose(fp);}break;case 3:break;default :break;}if (i!=3){printf("\n 继续修改其他教师的信息吗?(y或n)");scanf("%c",&n);}}while((n=='y'||n=='Y')&&i!=3);}}/***********************************删除函数*****************************************/ void deletes(){struct teacher *head,*p1,*p2,*p3;int i;char k;FILE *fp;char n='n';p1=p2=p3=(struct teacher *)malloc(LEN);if((head=load())!=NULL){do{int num;char name[20];p1=head;system("cls");printf("\n\n\n >>>>>>>>>>> 删除教师信息<<<<<<<<<<<\n");printf(" *******************************************************\n");printf(" * 1.输入教师号*\n");printf(" * 2.输入姓名*\n");printf(" * 3.返回上级菜单*\n");printf(" *******************************************************\n");printf(" 请选择删除方式:");scanf("%d",&i);getchar();while (i<1||i>3){printf(" 输入有误!请重新输入:");scanf("%d",&i);getchar();}switch(i){case 1:printf(" 请输入要删除的信息的教师号:");scanf("%d",&num);getchar();while (p1->num!=num){if (p1->next!=NULL)p1=p1->next;else{printf(" 查找不到相关数据!\n");break;}}if (p1->num==num){printf("-----------------------------要删除的信息如下:--------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf\n",p1->cost_phone,p1->cost_water_ele c,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_all);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" 确定删除吗?(y或n):");scanf("%c",&k);getchar();}if (k=='y'||k=='Y'){if (p1->num==num){if(p1==head){p1=p1->next;p2=p1;}else if(p1->next==NULL){p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1->next=NULL;}else{p2=head;p3=p1;p1=head;while(p1->next!=p3){p1=p1->next;}p3=p3->next;p1->next=p3;}if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{do{fwrite(p2,LEN-4,1,fp);if(p2->next!=NULL)p2=p2->next;}while(p2->next!=NULL);if(p2!=head)fwrite(p2,LEN-4,1,fp);}fclose(fp);printf(" 删除成功!按下任意键继续...");getch();}}else {printf(" 删除已被取消!按下任意键继续...");getch();}break;case 2:printf(" 请输入要修改的教师姓名:");gets(name);while (strcmp((p1->name),name)!=0){if (p1->next!=NULL)p1=p1->next;else{printf(" 查找不到相关数据!\n");break;}}if (strcmp((p1->name),name)==0){printf("-----------------------------要删除的信息如下:--------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf \n",p1->cost_phone,p1->cost_water_elec,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_al l);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" 确定删除吗?(y或n):");scanf("%c",&k);getchar();}if (k=='y'||k=='Y'){if (strcmp((p1->name),name)==0){if(p1==head){p1=p1->next;p2=p1;}else if(p1->next==NULL){p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1->next=NULL;}else{p2=head;p3=p1;p1=head;while(p1->next!=p3){p1=p1->next;}p3=p3->next;p1->next=p3;}if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{do{fwrite(p2,LEN-4,1,fp);if(p2->next!=NULL)p2=p2->next;}while(p2->next!=NULL);if(p2!=head)fwrite(p2,LEN-4,1,fp);}fclose(fp);printf(" 删除成功!按下任意键继续...");getch();}}else {printf(" 删除已被取消!按下任意键继续...");getch();}break;case 3:break;default :break;}if (i!=3){printf("\n 继续删除其他教师的信息吗?(y或n)");scanf("%c",&n);}}while((n=='y'||n=='Y')&&i!=3);}}/***********************************浏览函数*****************************************/ void scan(){struct teacher *head,*p1;int i;。

相关文档
最新文档