员工绩效管理系统c语言
时间: 2023-07-03 16:05:04 浏览: 124
C语言员工管理系统源码和文档.zip
员工绩效管理系统可以使用C语言编写。下面是一个简单的员工绩效管理程序的示例代码:
```
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct employee {
char name[20];
int age;
int salary;
float rating;
};
int main() {
struct employee emp[100];
int i, n, choice;
char ch;
printf("Enter the number of employees: ");
scanf("%d", &n);
for(i=0; i<n; i++) {
printf("Enter the details of employee %d:\n", i+1);
printf("Name: ");
scanf("%s", emp[i].name);
printf("Age: ");
scanf("%d", &emp[i].age);
printf("Salary: ");
scanf("%d", &emp[i].salary);
printf("Rating: ");
scanf("%f", &emp[i].rating);
}
do {
printf("\n\n1. Display employee details\n");
printf("2. Find highest rated employee\n");
printf("3. Find highest paid employee\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch(choice) {
case 1:
printf("\n\nEmployee Details:\n");
for(i=0; i<n; i++) {
printf("Name: %s\n", emp[i].name);
printf("Age: %d\n", emp[i].age);
printf("Salary: %d\n", emp[i].salary);
printf("Rating: %.2f\n", emp[i].rating);
printf("\n");
}
break;
case 2:
printf("\n\nHighest rated employee:\n");
float highest_rating = emp[0].rating;
int index1 = 0;
for(i=1; i<n; i++) {
if(emp[i].rating > highest_rating) {
highest_rating = emp[i].rating;
index1 = i;
}
}
printf("Name: %s\n", emp[index1].name);
printf("Age: %d\n", emp[index1].age);
printf("Salary: %d\n", emp[index1].salary);
printf("Rating: %.2f\n", emp[index1].rating);
break;
case 3:
printf("\n\nHighest paid employee:\n");
int highest_salary = emp[0].salary;
int index2 = 0;
for(i=1; i<n; i++) {
if(emp[i].salary > highest_salary) {
highest_salary = emp[i].salary;
index2 = i;
}
}
printf("Name: %s\n", emp[index2].name);
printf("Age: %d\n", emp[index2].age);
printf("Salary: %d\n", emp[index2].salary);
printf("Rating: %.2f\n", emp[index2].rating);
break;
case 4:
printf("\n\nExiting the program...\n");
exit(0);
default:
printf("\n\nInvalid choice. Try again.\n");
}
printf("\n\nDo you want to continue? (y/n): ");
scanf(" %c", &ch);
} while(ch == 'y' || ch == 'Y');
return 0;
}
```
这个程序使用结构体来存储每个员工的姓名、年龄、薪水和绩效评级。程序提供了多个选项,例如显示员工详细信息、找到评级最高的员工等等。
阅读全文