题巨长,但是不难,一个bug调了好长时间,终于ac了。浮点数加上1e-5;当数据库空的时候直接输出0.00(虽然udebug里是输出nan);还有选操作4时输出的单引号应该是英文的,样例给的是中文的。
传送门:UVA-12412
AC代码:
#include<iostream>
#include<map>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
const double eps=1e-5;
struct student{
int cla,pos,ma,en,ch,co,all,rank;//cla代表班级,ma表示数学,en表示英语,ch表示语文,co表示编程,all表示总分,rank表示排名,pos表示进入库的顺序
double ave;//均分
string name,num;//num表示编号
};
int all_cnt;
map<string,student> pq;//按编号存储数据
vector<student> op;
//按进入先后排序
bool cmp1 (student a,student b){
return a.pos<b.pos;
}
//按分数排序
bool cmp2 (student a,student b){
return a.all>b.all;
}
void start()
{
printf("Welcome to Student Performance Management Syst