更多"下列程序的输出结果是 【11】 。 # include<iostre"的相关试题:
[填空题]下列程序的输出结果是 【11】 。
# include<iostream.h>
template <class T>
T max(T x[],int n)
int i;
T maxv=x[0];
for(i=1;i<n;i++)
if(maxv<x[i])
maxv=x[i];
return maxv;
void main( )
int a[]=3,2,7,6,8,9;
double b[]=1.2,3.4,2.5,7.3,6.8;
cout<<max(a,4)<<","<<max(b,3)<<endl;
[填空题]下列程序的输出结果是______。
#include<iostream.h>
template<class T>
T max(T x[],int n)
int i;
T max v=x[0];
for(i=1;i<n;i++)
if(max v<x[i])
max v=x[i];
return max v;
void main( )
int a[]=3,2,7,6,8,9;
double b[]=(1.2,3.4,2.5,7.3,6.8;
cout<<max(a,4)<<", "<<max(b,3)<<end1;
[单项选择]下面程序的输出结果是( )。
#include
#include
voidmain()
{
charp1[10],p2[10];
strcpy(p1,"abc");
strcpy(p2,"ABC");
charstr[50]="xyz":
strcpy(str+2,strcat(p1,p2));
cout< }
A. xyzabcABC
B. zabcABC
C. xyabcABC
D. yzabcABC
[单项选择]如下程序的输出结果是 #include<iostream> #include<iomanip> using namespace std; class CSum{ int x,y; public: CSum(int x0,int y0):X(x0),y(y0){ } friend ostream& operator<<(ostream& os,const CSum& xA) { os<<setw(5)<<xa.x+xa.y: return os; } }; int main( ){ CSum y(3,5); cout<<setfill(’*’)<<8; cout<<y; return 0; }
A. 88
B. ****88
C. ****8****8
D. 8****8
[单项选择]如下程序的输出结果是 #include<iostream> #include<cstring> using namespace std; class XCF{ int a; public: XCF(int aa=0):a(aA) {cout<<"1";} XCF(XCF&X){a=x.a;cout<<"2";l ~XCF( ){cout<<a;} int Geta( )t return a;} }; int main( ){ XCF d(15),d2(d1); XCF*pd=new XCF(8); cout<<pd->Geta( ); delete pd; return 0; }
A. 1215588
B. 1218855
C. 12185
D. 128512
[单项选择]如下程序的输出结果是 #include<lostream> #include<cstring> using namespace std; class XCD{ char*a; int b; public: XCD(char*aa,int bB) { a=new char[strlen(aA) +1]; strcpy(a,aA) ; b=bb; } char*Geta( ){return a;} int Getb( ){return b;} }; int main( ){ char*pl="abcd",*p2="weirong": int dl,6,d2=8; XCD x(pl,d1),y(p2,d2); cout<<strlen(x.Geta( ))+y.Getb( )<<endl; return 0; }
A. 12
B. 16
C. 14
D. 11
[填空题]下列程序输出结果是 【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;
}
[填空题]下列程序输出结果是 【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;
[单项选择]下面程序的输出结果是( )。
#include
Usingnamespacestd;
ClassBase{
public:
Base(intx=O){count< }
};
ClassDerived:publicBase{
public:Derved(intx=0{count< }
private;
Baseval;
};
intmina(){
Derivedd(1);
retrun0;
}
A. 0
B. 1
C. 01
D. 001
[填空题]
以下程序运行后的输出结果是()。
#include
#include
#include
main( )
{ char *p;int i;
p=(char*)malloc(sizeof(char)*20);
strcpy(p,"welcome");
for(i=6;i>=0;i--) putchar(*(p+i));
printf("/n"); free(p);
}
[单项选择]下面程序的输出结果是
#include<iostream.h>
#include<string.h>
void main( )
char p1[10],p2[10]
strcpy(p1,"abc");
strcpy(p2,"ABC");
char str[50]="xyz";
strcpy(str+2,strcat(p1,p2));
cout<<str;
A. xyzabcABC
B. zabcABC
C. xyabcABC
D. yzabcABC
[单项选择]下面程序的输出结果是 #include<iostream.h> #include<string.h> void main( ) { char p1[10],p2[10] strcpy(p1,"abc"); strcpy(p2,"ABC"); char str[50]="xyz"; strcpy(str+2,strcat(p1,p2)); cout<<str; }
A. xyzabcABC
B. zabcABC
C. xyabcABC
D. yzabcABC
[单项选择]下面的程序输出结果是( )。
#include<iostream>
using namespace std;
void add( )
static int x;
x++;
cout<<x<<’’;
int main( )
for(int i=0;i<3;i++)
add( );
return 0;
A. 111
B. 123
C. 222
D. 333