问答题
试题五(共15分)
阅读以下说明和C++代码,将应填入(n)处的语句或语句成分写在答题纸的对应栏内。
【说明】
某数据文件students.txt的内容为100名学生的学号和成绩,下面的程序将文件中的数据全部读入对象数组,按分数从高到低进行排序后选出排名前30%的学生。
【C++代码】
#include
#include
#include
using namespace std;
class Student{
private:
string sNO; //学号
int credit://分数
public:
Student(string a,int b){sN0=a; credit=b;}
Student(){}
int getCredit();
void out();
};
(1)::getCredit(){
return credit;
}
(2)::out(){
Cout<<“SNO:“<
问答题
1.
问答题
2.
【正确答案】void Student
【答案解析】
问答题
3.
【正确答案】getCreadit()
【答案解析】
问答题
4.
【正确答案】getCreadit()
【答案解析】
问答题
5.
问答题
6.
【正确答案】SortStudent ss
【答案解析】