填空题
下列程序的输出结果为______。
#include<iostream.h>
int&max(int&x,int&y)
return(x>y x:y);)
void main( )
int n=3,m=12;
max(m,n)++;
cout<<"m="<<m<<",n=<<n<<endl;
【参考答案】
m=13,n=3
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
下列程序中需要清理动态分配的数组,划线处应有的语句是_______。 #include<iostream.h> class person int age,tall; public: person( )age=0;tall=40;cout<< A baby is born. <<endl; person(int i)age=i;tall=40;cout<< A old person. <<endl; person(int i,int j)age=i;tall=j;cout<< a old person with tall. <<endl;) ~person( )cout<< person dead. <<endl; void show( ) cout<< age= <<age<< ,tall= <<tall<<endl; ; void main( ) person*ptr; ptr=new person[3]; ptr[0]=person( ); ptr[1]=person(18); ptr[2]=person(20,120); for(int i=0;i<3;i++) ptr[i].show( ); ______
点击查看答案&解析
填空题
下列程序的执行结果是______。 #include<iostream.h> class Student public: Student(int xx)x=xx; virtual float calcTuition( ); protected: int x; ; float Studertt::calcTuition( ) return float(x*x); class GraduateStudent:public Student public: GraduateStudent(int xx):Student(xx) float calcTuition( ); ; float Graduatestudent::calcTuition( ) return float(x*2); void main( ) Student s(20); GraduateStudent gs(30); cout<<s.calcTuition( )<< <<gs.calcTuition( )<<endl; 计算学生s和研究生gs的学费
点击查看答案
相关试题
下列程序完成从文件读取文件显示的同时写入...
下面程序编译时发现ma[3]=9错误,其原...