-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutput.cpp
More file actions
103 lines (89 loc) · 4.16 KB
/
Copy pathOutput.cpp
File metadata and controls
103 lines (89 loc) · 4.16 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
94
95
96
97
98
99
100
101
102
103
//
// Created by Wen34 on 2026/3/26.
//
#include "Output.h"
#include <iomanip>
#include <iostream>
using namespace std;
#include "struct.h"
#include <vector>
#include <cstring>
void Show_Mark_List(vector<Tmarks> &applicants)
{
// 输出成绩总表
cout << "\n成绩总表(按总分从高到低排序):" << endl;
cout << left << setw(15) << "姓名" << setw(20) << "政策法律" << setw(14) << "语文"
<< setw(12) << "英语" << setw(13) << "计算机" << setw(14) << "口试"
<< setw(14) << "学历分" << setw(14) << "年龄分" << setw(14) << "工作分" << setw(10)
<< "总分" << endl; // 输出表头
cout << "------------------------------------------------------------------------------------------------------" << endl;
// 输出分隔线
for (int i = 0; i < applicants.size(); i++)
{
cout << left << setw(15) << applicants[i].name
<< setw(10) << fixed << setprecision(2)
<< applicants[i].mark.pol
<< setw(10) << applicants[i].mark.chn
<< setw(10) << applicants[i].mark.eng
<< setw(10) << applicants[i].mark.com
<< setw(10) << applicants[i].mark.oral
<< setw(10) << applicants[i].Srecord
<< setw(10) << applicants[i].Sage
<< setw(10) << applicants[i].Swlen
<< setw(10) << applicants[i].total
<< endl;
}
}
void Show_Admission_Letter(vector<Tmarks> &applicants)
{
// 输出录取通知书
int numToRecruit = min(5, (int)applicants.size()); // 前5名应聘者
cout << "\n录取通知书(前" << numToRecruit << "名):" << endl; // 输出录取通知书
cout << "----------------------------------------------------------------------------------------------" << endl;
for (int i = 0; i < numToRecruit; i++) // 遍历前5名
{
cout << "恭喜 " << applicants[i].name << " 被录取为副局长!" << endl; // 输出录取信息
cout << "录取信息:总分 " << fixed << setprecision(2) << applicants[i].total << " 分" << endl; // 输出总分
cout << "----------------------------------------------------------------------------------------------"
<< endl;
// 输出分隔线
}
}
void Query_Applicant(vector<Tmarks> &applicants) // 查询功能
{
char queryName[20]; // 查询功能,输入姓名
cout << "\n请输入要查询的姓名(输入'exit'退出查询): "; // 输入提示
while (cin >> queryName) // 输入姓名
{
if (strcmp(queryName, "exit") == 0) // 判断是否退出查询
{
break;
}
bool found = false; // 是否找到
for (int i = 0; i < (int)applicants.size(); i++) // 遍历应聘者列表
{
if (strcmp(applicants[i].name, queryName) == 0) // 判断是否找到
{
cout << "\n查询结果:" << endl;
cout << "姓名: " << applicants[i].name << endl;
cout << "政策法律: " << fixed << setprecision(2)
<< applicants[i].mark.pol << endl;
cout << "语文: " << applicants[i].mark.chn << endl;
cout << "英语: " << applicants[i].mark.eng << endl;
cout << "计算机: " << applicants[i].mark.com << endl;
cout << "口试: " << applicants[i].mark.oral << endl;
cout << "学历分: " << applicants[i].Srecord << endl;
cout << "年龄分: " << applicants[i].Sage << endl;
cout << "工作经历分: " << applicants[i].Swlen << endl;
cout << "总分: " << applicants[i].total << endl;
found = true; // 找到应聘者
break;
}
}
if (!found) // 未找到
{
cout << "未找到姓名为 " << queryName << " 的应聘者!" << endl; // 输出未找到信息
}
cout << "\n请输入要查询的姓名(输入'exit'退出查询): "; // 再次输入姓名
}
}