-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcess.cpp
More file actions
93 lines (87 loc) · 2.08 KB
/
Copy pathProcess.cpp
File metadata and controls
93 lines (87 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//
// Created by Wen34 on 2026/3/26.
//
#include "Process.h"
#include <algorithm>
#include "compareByTotal.h"
float calcSchoolScore(char school)
{
switch(school)
{
case 'B':
return 100.0; // 博士
case 'M':
return 75.0; // 硕士
case 'U':
return 50.0; // 本科
default:
return 0.0; // 其他
}
}
// 计算年龄分(线性插值)
float calcAgeScore(float age)
{
// 先限制年龄范围
if (age < 30) age = 30;
if (age > 55) age = 55;
// 再根据限制后的年龄计算分数
if (age <= 35)
{
return 70.0 + (age - 30) * 2.0;
}
else if (age <= 40)
{
return 80.0 + (age - 35) * 4.0;
}
else if (age <= 50)
{
return 100.0 - (age - 40) * 2.5;
}
else
{
// age > 50 (and <=55 due to clamp above)
return 75.0 - (age - 50) * 1.0;
}
}
// 计算工作经历分
float calcWorkScore(float worklen)
{
if (worklen <= 0 || worklen < 1)
{
return 0.0; // 小于1年(或非法值)无分
}
else if (worklen < 2)
{
return 70.0 + (worklen - 1) * 30.0;
}
else if (worklen <= 6)
{
return 100.0 - (worklen - 2) * 20.0;
}
else
{
// 如果工作年限超过6年,根据你的需求决定是给0分还是给一个基础分
// 目前保持原样,给0分
return 0.0;
}
}
// 计算总分
float calcTotalScore(Tmarks &applicant) //考试总分
{
float written_total = applicant.mark.pol +
applicant.mark.chn +
applicant.mark.eng +
applicant.mark.com; //4项笔试分(百分制)
float oral_score = applicant.mark.oral * 2; //口试分*2
return written_total +
oral_score +
applicant.Srecord +
applicant.Sage +
applicant.Swlen;
}
// 按总分从高到低排序
void Application_Sort(vector<Tmarks> &applicants)
{
sort(applicants.begin(), applicants.end(), compareByTotal());
/*STL algorithm::sort()倒序*/
}