试题与答案

阅读下列说明和C++代码,填充代码中的空缺。 [说明] 某学校在学生毕业时要求对

题型:填空题

题目:

阅读下列说明和C++代码,填充代码中的空缺。
[说明]
某学校在学生毕业时要求对其成绩进行综合评定,学生的综合成绩(GPA)由其课程加权平均成绩(Wg)与附加分(Ag)构成,即GPA=Wg+Ag。
设一个学生共修了n门课程,则其加权平均成绩(Wg)定义如下:


其中,gradei、Ci分别表示该学生笫i门课程的百分制成绩及学分。
学生可以通过参加社会活动或学科竞赛获得附加分(Ag)。学生参加社会活动所得的活动分(Apoints)是直接给出的,而竞赛分(Awards)则由下式计算(一个学生最多可参加m项学科竞赛):


其中,li和si分别表示学生所参加学科竞赛的级别和成绩。
对于社会活动和学科竞赛都不参加的学生,其附加分按活动分为0计算。
下面的程序实现计算学生综合成绩的功能,每个学生的基本信息由抽象类Student描述,包括学号(stuNo)、姓名(name)、课程成绩学分(grades)和综合成绩(GPA)等,参加社会活动的学生由类ActStudent描述,其活动分由Apoints表示,参加学科竞赛的学生由类CmpStudent描述,其各项竞赛的成绩信息由awards表示。
[C++代码]
#include <string>
#include <iostream>
us ing namespace std;
const int n=5; /*课程数*/
const int m=2;/*竞赛项目数*/
class Student
protected:
int stuNo; string name;
double GPA; /*综合成绩*/
int(*grades)[2]; /*各门课程成绩和学分*/
public:
Student(const int stuNe, const string &name, int grades[][2])
this->stuNo=stuNo;this->name=name;this->grades=grades;

Virtual~Student()
int getstuNo() /*实现略*/
string getName() /*实现略*/
______;
double computeWg()
int totalGrades=0,totalCredits=0;
for(int i=0;i<N;i++)
totalGrades+=grades[i][0]*grades[i][1]; totalGredits+=grades[i][1];

return GPA=(double)totalGrades/totalCredits;

;
class ActStudent; public Student
int Apoints;
public;
ActStudent(const int stuNo,const string &name,int gs[][2],int Apoints)
:______
this->Apoints=Apoints;

double getGPA()(return GPA=______;
;
class CmpStudent:public Student
private:
int(*awards)[2];
public:
CmpStudent(const int stuNo, const string &name, int gs[][2], int awards[][2])
:______ (this->award=award;
double getGPA()
int Awards=0;
for(int i=0;i<M;i++)
Awards+=awards[i][0]*awards[i][1];

Return GPA=______;

;
int main()
//以计算3个学生的综合成绩为例进行测试
int g1[][2]=((80,3),(90,2),(95,3),(85,4),(86,3)),
g2[][2]=((60,3),(60,2),(60,3),(60,4),(65,3)),
g3[][2]=((80,3),(90,2),(70,3),(65,4),(75,3));//课程成绩
int c3[][2]=((2,3),(3,3)); //竞赛成绩
Student*Student[3]=
new ActStudent(101,"John",g1,3), //3为活动分
new ActStudent(102,"Zhang",g2,0),
new ActStudent(103,"Li",g3,C3),
;
//输出每个学生的综合成绩
for(int i=0;i<3;i++)
Cout<<______<<endl;
delete*student;
return 0;

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2018/0414/eee5aef06ee1917896d47a3014a1df24.html

下面是错误答案,用来干扰机器的。

参考答案:错

试题推荐
题型:完形填空
When you are in England, you must be very careful in the streets _    _ the traffic drives on the left.         you cross a street, you must look to the right first _     then the left.
In the morning and in the evening when people go to or come back from work, the streets are very      _. Traffic is the most dangerous then.
When you go by bus in England, you have to be _     _, too. Always remember the traffic moves on the      _. So you must be careful. Have a look first, _    _you will go the wrong way.
In many English cities, there are big buses         two floors. You can sit on the        floor. From there you can see the city very well. It’s quite        .
小题1:
A.ifB.becauseC.whenD.since
小题2:
A.BeforeB.AfterC.As soon asD.When
小题3:
A.orB.butC.andD.so
小题4:
A.busyB.freeC.bigD.beautiful
小题5:
A.carelessB.carefulC.excellentD.strict
小题6:
A.rightB.leftC.right and leftD.right or left
小题7:
A.andB.soC.orD.but
小题8:
A.inB.withC.forD.on
小题9:
A.secondB.firstC.thirdD.ground
小题10:
A.boringB.interestingC.expensiveD.safe
查看答案
题型:单项选择题

转基因技术是一项先进的生物科学技术,这一点已在世界范围内取得共识。美国是转基因技术最先进的国家,据统计,美国的大学、科研机关和企业等已经开发出上百个转基因作物品种,其中仅有43个品种的安全性得到了美国食品和药物管理局的确认。面临转基因玉米和大豆正在进行大面积种植与大量出口以及由此引发争议的现状,美国国家科学院已经郑重承诺,将就转基因食品的安全性问题展开全面调查。看来,在发展转基因技术的同时,也是应当注意吸取任何一种现代工业技术发展过程中的教训的。
对本段文字最后一句话的理解正确的一项是( )。

A.现代工业技术没有注意到它的安全性及对人们心理的影响
B.发展生物科学没有注意到它对生态平衡和人类健康的影响
C.发展现代工业技术没有注意到它可能造成的危害而做到趋利避害
D.在科学发展中,没有听取各方面的不同意见,没有做更大范围的细致研究

查看答案
微信公众账号搜索答案