选择题:阅读下列程序说明和C++代码,将应填入(n)处的字句写在对应栏内。 [说明] ①定义私有数据成员code、en

  • 题目分类:软考中级
  • 题目类型:选择题
  • 查看权限:VIP
题目内容:
阅读下列程序说明和C++代码,将应填入(n)处的字句写在对应栏内。

[说明]

①定义私有数据成员code、english分别用于表示考生的编号、英语成绩,它们都是int型的数据。

②完成成员函数void Student::inputinformation()的定义,该函数用于用户输入一个考生对象的信息,输入格式如下:

输入编号:

英语成绩:

计算机成绩:

③利用已实现的类Student的成员函数,完成函数void firstname(Student *A[],int uum)的定义,该函数根据考生信息A[],输出num个考生中总分最高者的编号及其相应的总分,在此不考虑总分相同的情况。

源程序文件test1.cpp清单如下:

include < iostream. h >

class Student

(1)

int computer;

int total;

public

void getinformation( );

void computesum( );

int getcode( );

int gettotalscore( );

~Student( );

};

void Student: :getinformation( )

{

(2)

cout <<"英语成绩:";

cin> >english;

cout <<"计算机成绩:";

cin > > computer;

void Student:: computesum ( )

total = english + computer;

cout <<"编号" << code <<"总分:" <<total << endl;

int Student::getcode( )

return code;

}

int Student:: gettotalscore ( )

{

return total;

}

void firstname(Student * A[] ,int num)

{

(3)

tempsum = ( * A[0] ). gettotalscore( );

for( int i=1; i <num; i++)

{

if ( ( ( * A[i] ). gettotalscore( ) ) > tempsum)

{

tempcode = ( * A[i] ). getcode( );

tempsum = ( * A[i] ). gettotalscore( );

}

}

cout <<"总分最高者--" << tempcode <<":" << tempsum <<endl;

}

void main( )

{

Student * A[3];

int i,n =3

for(i=0;i<n;i ++)

A[i] = new Student;

A[i] -> getinformation( )

for(i=0;i<n;i ++)

{

A[i] -> computesum( )

firstname ( A,3 );

}




参考答案:

适用于癫痫局灶性发作的药物有( )

适用于癫痫局灶性发作的药物有( )A.卡马西平 B.托吡酯 C.奥卡西平 D.苯妥英钠 E.左乙拉西坦

查看答案

与黄连上清丸不宜联用的药物是

与黄连上清丸不宜联用的药物是A.乳酶生 B.氨茶碱 C.苯巴比妥 D.氢氧化铝 E.甲氧氯普胺

查看答案

下列关于解热药的使用叙述错误的是

下列关于解热药的使用叙述错误的是A.退热属对症治疗,可能会掩盖病情 B.应严格掌握用量,避免滥用,老年人应减量 C.多数宜在餐后服用 D.阿司匹林可用于儿童降热 E.解热镇痛药大多有交叉过敏反应

查看答案