金枝 巫术:班级成绩查询系统用C++Builder6.0版怎么编啊?

来源:百度文库 编辑:高考问答 时间:2024/05/03 05:55:51

用个STRUCT就完成了
你没具体的东西拿出来,我也只能给你粗略的代码了
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
struct student{
string name;
int scoure;
};
int main(){
vector<student> vs;
student st;
while(cin>>st.name>>st.scoure&&(st.scoure!=-1))
vs.push_back(st);
sort(vs.begin,vs.end);
/*查找不用我写了吧,一般情况线性找就行了,会二分的话用二分找,不过班级嘛,线形就够了*/
}