试题查看

首页 > 软件水平考试 > 试题查看
【分析解答题】

【说明】 本程序用于评选优秀教师和学生。当输入一系列教师或学生的记录后,将优秀学生及教师的姓名列出来。其类结构如下图所示:

【程序】 #include <iostream.h> #include <stdio. h> class base{ protected: char name[8]; public: void getname(){cout<<"name:"; cin>>name;} void printname(){cout<<"name:"<<name<<endl;} {{U}} (1) {{/U}} }; class student:{{U}} (2) {{/U}} { int num; public: void getnum() {cout<<"score:"; cin>>num;} bool isgood() {return{{U}} (3) {{/U}}} }; class teacher:{{U}} (2) {{/U}} { int num; public: void getnum() {cout<<"paper:"; cin>>num;} bool isgood() {return (num>3) true:false;} void main() { base *p[50]; student *pstud; teacher *ptech; char ch; int count=0; do{cout<<"input teacher(t) or student(s):";cin>>ch;if(ch==’s’){ pstud=new student; pstud->getname(); pstud->getnum(); p[count++]=pstud;}else if(ch==’t’){ {{U}} (4) {{/U}} ptech->getname(); ptech->getnum(); p[count++]=ptech;}else cout<<"input is wrong"<<endl; cout<<"continue to iput(y/n) "; cin>>ch; }while(ch==’y’); for(int i=0;i<count;i++) if({{U}} (5) {{/U}}) p[i]->printname(); }
查看答案解析

参考答案:

正在加载...

答案解析

正在加载...

根据网考网移动考试中心的统计,该试题:

0%的考友选择了A选项

0%的考友选择了B选项

0%的考友选择了C选项

0%的考友选择了D选项

你可能感兴趣的试题

阅读以下应用说明及VisualBasic程序代码,将应填入(n)处的字句写在对应阅读以下应用说明、属性设置及VisualBssic程序代码,将应填入(n)处在字阅读以下应用说明及VisualBasic程序代码,将应填入(n)处的字句写在对应【说明】计算三角函数sinx给定精度e和n,若第k步后的结果为sin1,第k+1【说明】本程序输出10000之内的所有完全数。完全数是指等于其所有因子和(包括1【程序2.1说明】求所有满足如下条件的三位数:它除以11得的商等于它各位数字的平