[说明]
设计一个评选优秀教师和学生的程序,其类结构如下图所示。当输入一系列教师或学生的记录后,将优秀学生及教师的姓名列出来。
[C++程序]
#include<iostream. h>
#include<stdio. h>
enum boolean False,True;
class base
Protected:
char name [8];
public :
void getname( ) cout<<"姓名:";cin>>name;
void printname( ) cout<<"姓名:"<<name<<endU
virtual boolean isgood ( ) =0;
class student: (1)
int num;
public :
voici getnum ( )
cout<<"考绩:"; cin>>num;
boolean isgood( ) return (2) ;
;
class teacher: (3)
int num;
public :
void getnum ( )
cout<<"每年发表论文数:"; cin>>num;
boolean isgood( ) return (4) ;
void main ( )
base *p[50];
student*pstud;
teacher*ptech;
char ch;
int count=0;
do
cunt<<"输入教师(t)或学生(S):";
cin>>ch;
if(ch==’s’)
pstud=new student;
pstud->getname ( );
pstud->getnum( );
p [count++] =pstud;
else if(ch==’t’)
ptech=newteacher;
ptech->getname( );
ptech->getnum( );
p[count++]=ptech;
else
cout<<"输入错误"<<endl;
cout<<"继续输入吗(Y/n)";
cin>>ch;
while(ch==’Y’);
for (int i=0;i<count;i++)
if( (5) ) //若为优秀,则输出之
p [i]->printname( );
(4)处填()
题库:初级程序员
类型:填空题
时间:2017-07-03 12:01:08
免费下载:《填空集》Word试卷
[说明]
设计一个评选优秀教师和学生的程序,其类结构如下图所示。当输入一系列教师或学生的记录后,将优秀学生及教师的姓名列出来。
[C++程序]
#include<iostream. h>
#include<stdio. h>
enum boolean False,True;
class base
Protected:
char name [8];
public :
void getname( ) cout<<"姓名:";cin>>name;
void printname( ) cout<<"姓名:"<<name<<endU
virtual boolean isgood ( ) =0;
class student: (1)
int num;
public :
voici getnum ( )
cout<<"考绩:"; cin>>num;
boolean isgood( ) return (2) ;
;
class teacher: (3)
int num;
public :
void getnum ( )
cout<<"每年发表论文数:"; cin>>num;
boolean isgood( ) return (4) ;
void main ( )
base *p[50];
student*pstud;
teacher*ptech;
char ch;
int count=0;
do
cunt<<"输入教师(t)或学生(S):";
cin>>ch;
if(ch==’s’)
pstud=new student;
pstud->getname ( );
pstud->getnum( );
p [count++] =pstud;
else if(ch==’t’)
ptech=newteacher;
ptech->getname( );
ptech->getnum( );
p[count++]=ptech;
else
cout<<"输入错误"<<endl;
cout<<"继续输入吗(Y/n)";
cin>>ch;
while(ch==’Y’);
for (int i=0;i<count;i++)
if( (5) ) //若为优秀,则输出之
p [i]->printname( );
(4)处填()
本题关键词:教学过程优化,教学过程结构,教学评价目的,优秀班主任,优生,产前优生学诊断,教师学习,教学合一,教师知识结构,课程设计教学模式;