
提问人:网友f******g
发布时间:2023年4月1日 00:10
[]
阅读以下说明和C++程序,将应填入(n)处的字句写在答题纸的对应栏内。【说明】本程序用于评选优秀教师和学生。当输入一系列教师或学生的记录后,将优秀学生及教师的姓名列出来。其类结构如下图所示:【程序】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;}(1)};class student: (2){int num;public:void getnum(){cout<<'score:'; cin>>num;}bool isgood(){return (3) }};class teacher: (2){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'){(4)ptech->getname();ptech->getnum();p[count++]=ptech;}elsecout<<'input is wrong'<<endl;cout<<'continue to iput(y/n)?';cin>>ch;}while(ch=='y');for(int i=0;i<count;i++)if((5))p[i]->printname();}
A.shangxueba.cn/images/ct_csrppxm_crppxprogxcc_00243(200911).jpg'B.h>

