1.用C语言设计并实现一个员工信息管理系统
2.è¦äº¤ä½ä¸äºï¼ç¨cè¯è¨ç¼åä¸ä¸ªå·¥èµç®¡çç³»ç»
用C语言设计并实现一个员工信息管理系统
#include <iostream>
#include <cstring>
using namespace std;
typedef struct wage {
char unit[8];
char name[];
char sex[4];
char birthdate[];
char title[];
double basewage;
double subsidy;
double tax;
double expenses;
double residualwage;
}WAGE;
void ComputerResidualwage(WAGE a[],工工资管理int n) {
for(int i = 0; i < n; ++i)
a[i].residualwage = a[i].basewage + a[i].subsidy - a[i].tax - a[i].expenses;
}
void PrintTitle(void) {
cout << "单 位 姓 名 性别 出生年月 职 称 基本工资 津 贴 个 税 水电费 实发工资\n";
for(int i = 0; i < ; ++i) cout << "*"; cout << endl;
}
void RowShow(WAGE a[], int i) {
cout << a[i].unit << " ";
if(strlen(a[i].name) == 4) {
a[i].name[6] = a[i].name[4];
a[i].name[5] = a[i].name[3];
a[i].name[4] = a[i].name[2];
a[i].name[2] = a[i].name[3] = ' ';
}
cout << a[i].name << " " << a[i].sex << " " << a[i].birthdate;
if(strlen(a[i].title) == 4) {
a[i].title[6] = a[i].title[4];
a[i].title[5] = a[i].title[3];
a[i].title[4] = a[i].title[2];
a[i].title[2] = a[i].title[3] = ' ';
}
cout << " " << a[i].title << " ";
cout.precision(2);
cout.width(8);
cout << fixed << a[i].basewage << " "; cout.width(6);
cout << fixed << a[i].subsidy << " ";
cout.width(8);
cout << fixed << a[i].tax << " ";
cout.width(6);
cout << fixed << a[i].expenses << " ";
cout.width(8);
cout << fixed << a[i].residualwage << endl;
}
void Show(WAGE a[], int n) {
for(int i = 0; i < n; ++i) RowShow(a,i);
}
void Search1(WAGE a[], int n) {
int i,flag = 1;
for(i = 0; i < n; ++i) {
if(strcmp(a[i].unit,"理学院") == 0 && a[i].basewage > . &&
strcmp(a[i].title,"副教授") == 0 && strcmp(a[i].sex,"男") == 0) {
RowShow(a,i);
flag = 0;
}
}
if(flag) cout << "(没找到符合条件者)\n";
}
void Search2(WAGE a[], int n) {
int i,flag = 1;
for(i = 0; i < n; ++i) {
if(strcmp(a[i].unit,"理学院") == 0 && a[i].basewage < . &&
strcmp(a[i].title,"教 授") == 0 && strcmp(a[i].sex,"男") == 0) {
RowShow(a,i);
flag = 0;
}
}
if(flag) cout << "(没找到符合条件者)\n";
}
int main() {
WAGE a[] = {
{ "理学院","赵志军","男","--","教 授",,,.6,},
{ "商学院","于 铭","女","--","助 教",,,.9,},
{ "工学院","许炎锋","女","--","教 授",,,.2,},
{ "理学院","王 嘉","女","--","讲 师",,,.3,},
{ "工学院","李新江","男","--","教 授",,,.5,},
{ "商学院","郭海英","女","--","副教授",,,.6,},
{ "工学院","马淑恩","女","--","副教授",,,.5,},
{ "理学院","王金科","男","--","教 授",,,.6,},
{ "理学院","李东慧","女","--","教 授",,,.3,},
{ "工学院","张 宁","女","--","助 教",,,,},
{ "商学院","王 孟","男","--","讲 师",,,.3,},
{ "工学院","马会爽","女","--","讲 师",,,.1,},
{ "工学院","史晓赟","女","--","教 授",,,.3,},
{ "理学院","刘燕凤","女","--","教 授",,,.9,},
{ "工学院","齐 飞","男","--","副教授",,,.6,},
{ "商学院","张 娟","女","--","助 教",,,.3,},
{ "理学院","潘成文","男","--","讲 师",,,,},
{ "工学院","邢 易","女","--","助 教",,,,},
{ "商学院","谢枭豪","女","--","教 授",,,,},
{ "工学院","胡洪静","女","--","教 授",,,,},
{ "工学院","李云飞","男","--","讲 师",,,,},
{ "商学院","张 奇","女","--","讲 师",,,,},
{ "理学院","夏小波","女","--","讲 师",,,,},
{ "工学院","王 玮","女","--","讲 师",,,,},
{ "理学院","张 帝","女","--","教 授",,,,},
{ "商学院","孙 帅","男","--","讲 师",,,,},
{ "工学院","卜辉娟","女","--","教 授",,,,},
{ "工学院","李辉玲","女","--","助 教",,,,},
{ "理学院","刘亚静","男","--","副教授",,,,},
{ "工学院","尹 娴","女","--","教 授",,,,},
{ "商学院","马春英","男","--","讲 师",,,,},
{ "工学院","孟 梦","女","--","副教授",,,.6,},
{ "工学院","梁晓萌","女","--","助 教",,,.5,},
{ "理学院","张 然","女","--","讲 师",,,.1,},
{ "工学院","彭雁南","男","--","助 教",,,,}
};
int i,n = sizeof(a)/sizeof(a[0]);
if(n == 0) return 1;
ComputerResidualwage(a,n);
PrintTitle();
for(i = 0; i < n; ++i) RowShow(a,i);
for(i = 0; i < ; ++i) cout << "*";
cout << endl; cout << "\n理学院,基本工资高于元的资管总结pdf批量转pdf源码男副教授有:\n\n";
PrintTitle();
Search1(a,n);
for(i = 0; i < ; ++i) cout << "*";
cout << endl;
cout << "\n理学院,基本工资低于元的理系update自动更新源码男教授有:\n\n";
PrintTitle();
Search2(a,n);
for(i = 0; i < ; ++i) cout << "*";
cout << endl << endl;
return 0;
}
è¦äº¤ä½ä¸äºï¼ç¨cè¯è¨ç¼åä¸ä¸ªå·¥èµç®¡çç³»ç»
/*ççè¿ä¸ªç¼ç*/
#include "stdio.h" /*æ åè¾å ¥è¾åºå½æ°åº*/
#include "stdlib.h" /*æ åå½æ°åº*/
#include "string.h" /*å符串å½æ°åº*/
#include "conio.h" /*å±å¹æä½å½æ°åº*/
#define HEADER1 " -------------------------------ZGGZ---------------------------------------- \n"
#define HEADER2 "| number| name | jbgz | jj | kk | yfgz | sk | sfgz | \n"
#define HEADER3 "|--------|-----------|--------|--------|--------|--------|--------|--------| \n"
#define FORMAT "|%-8s|%-s |%8.2f|%8.2f|%8.2f|%8.2f|%8.2f|%8.2f| \n"
#define DATA p->num,p->name,p->jbgz,p->jj,p->kk,p->yfgz,p->sk,p->sfgz
#define END "---------------------------------------------------------------------------- \n"
#define N
int saveflag=0; /*æ¯å¦éè¦åççæ å¿åé*/
/*å®ä¹ä¸èå·¥æå ³çæ°æ®ç»æ*/
typedef struct employee /*æ 记为employee*/
{
char num[]; /*èå·¥ç¼å·*/
char name[]; /*èå·¥å§å*/
float jbgz; /*åºæ¬å·¥èµ*/
float jj; /*å¥é*/
float kk; /*æ£æ¬¾*/
float yfgz; /*åºåå·¥èµ*/
float sk; /*ç¨æ¬¾*/
float sfgz; /*å®åå·¥èµ*/
}ZGGZ;
void menu() /*主èå*/
{
system("cls"); /*è°ç¨DOSå½ä»¤ï¼æ¸ å±.ä¸clrscr()åè½ç¸å*/
textcolor(); /*å¨ææ¬æ¨¡å¼ä¸éæ©æ°çå符é¢è²*/
gotoxy(,5); /*å¨ææ¬çªå£ä¸è®¾ç½®å æ */
cprintf(" The Employee' Salary Management System \n");
gotoxy(,8);
cprintf("