更多"下列程序的输出结果是 【15】 。#include <iostream"的相关试题:
[单项选择]下列程序的输出结果是 #include"iostream" using namespace std; int Max(int a,int b) { if(a>b) return a; else return b; } void main( ) { int m,n; m=10,n=5; int max = Max(m,n); cout<<max<<endl; }
A. 10
B. 程序有误
C. 1
D. 0
[单项选择]以下程序输出结果是( ):
#include<iostream>
using namespace std;
void add(int x,int y,int *z)
*z=y+x;
int main( )
int a,b,c;
add(8,4,&a);
add(6,a,&b);
add(a,b,&c);
cout<<a<<","<<b<<","<<c<<end1;
return 0;
A. 12, 10, 14
B. 12, 18, 30
C. 12, 6, 18
D. 12, 14, 30
[单项选择]以下程序执行后的输出结果是 #include <iostream> using namespace std; void try(int,int,int,int); int main ( ) { int x,y,z,r; x =1 ; y = 2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y,int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A. 18
B. 9
C. 10
D. 不确定
[填空题]下列程序的输出结果是 【15】 。
#include <iostream>
using namespace std;
class A
int a;
public:
A( ):a(9)
virtual void print( ) const cout<<a; ;
;
class B: public A
char b;
public:
B( )b=’S’;
void print( ) const cout <<b;
;
void show(A &x) x. print( );
int main( )
A d1,*p;
B d2;
p=&d2;
dl1.print( );
d2.print( );
p->print( );
show(d1);
show(d2);
return 0;
[填空题]下列程序的输出结果是 【12】 。
#include <iostream>
using namespace std;
int main( ) int i=5;
int &r=i; r=7;
cout<<i<<end1;
return 0;
[填空题]下列程序的输出结果是 【13】 。
#include <iostream>
using namespace std;
int main( ) int data=1;
int &r = data;
data+=5;
r+=5;
cout<<data<<end1;
return 0;
[单项选择]执行如下程序将输出( ): #include<iostream> using namespace std; class Base { public: Base( ){cout<<"BB";fun( );} void fun ( ){tout<<"Brim";} }; class Derived:public Base { public: Derived( ){cout<<"DD";} void fun ( ){cout<<"Dfun";} }; int main( ){Derived d;return 0;}
A. DD
B. BBDfunDDDfun
C. BBBfunDD
D. DDBBBfun
[填空题]以下程序的输出是 【8】 。
#include<iostream>
using namespace std;
fun(intm)
static int n=1;
n=m*n;
return(n);
void main( )
int i;
for(i=1;i<=3;i++) cout<<fun(i);
[单项选择]有如下程序:
#include<iostream>
using namespace std;
class Base{
int x;
public:
Base(int n=0):x(n){cout<<n;)
int getX( )const{return x;}
};
class Derived:public Base{
int y;
public:
Derived(int m,int n):y(m,)Base(n){cout<<m;}
Derived(int m):y(m){cout<<m;}
};
int main( ){
Derived d1(3),d2(5,7)
return 0;
}
运行时的输出结果是
A. 375
B. 357
C. 0375
D. 0357
[单项选择]下面程序的执行结果为 #include"iostream" using namespace std; class A { int a; public: void Seta(int x){a=x;} void Display_a( ){cout<<a<<endl;} }; class B { int b; public: void Setb(int x){b=x;} void Dispaly-b( ) {cout<<b<<endl;} }; class C://public A,private B { private: int c; public: void Setc(int x,int y,int z) {c=z;Seta(x);Setb(y);} void Display_c( ){ cout<<c<<endl;} }; ①void main( ) ② { ③ C cc; ④ cc.Seta(1); ⑤ cc.Display_a( ); ⑥ cc.Setc(2,2,3); ⑦ cc.Dispaly-b( ); ⑧ cc.Display_c( ); }
A. 输出为2 2 3
B. 有错误在第5行
C. 输出为1 2 3
D. 有错误在第7行
[填空题]下列程序的输出结果是_【10】__。
#include
using namespace std;
class Base{
public:
int m,n;
Base(int i,int j):m(i),n(j){}
};
class Derived:public Base{
public:
int m, k;
Derived(int i,int j):Base(i,j),m(i+1),k(j+1){}
};
int main(){
Derived d(1;5);
Cout<
[填空题]下列程序输出结果是 【13】 。
include <iostream>
using namespace std;
template <typename T>
T fun(T a, T b) return (a<=b)a:b;
int main( )
cout<<fun(3,6)<<’,’<<fim(3.14F, 6.28F)<<end 1;
return 0;