网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
下面程序的输出结果是()。includeusing namespace std;templateT max(T x,T

下面程序的输出结果是( )。 #include<iostream> using namespace std; template<class T> T max(T x,T y) { return(x>= y ? x:y);} template<class T> T max(T x,T y,T z) { T t; t=(x>=y ? x:y); return(t>=z ? t:z); } void main(){ int x = 10,y=18,maxi; float a = 1.2,b = 3.2,c = 2,max2; max1 = max(x,(int)c); max2 = max(a,b,(float)y); cout<<maxi<<endl; cout<<max2<<endl;

A.18 3.2

B.10 18

C.10 3.2

D.编译出错


参考答案

更多 “ 下面程序的输出结果是()。includeusing namespace std;templateT max(T x,T 下面程序的输出结果是( )。 #include<iostream> using namespace std; template<class T> T max(T x,T y) { return(x>= y ? x:y);} template<class T> T max(T x,T y,T z) { T t; t=(x>=y ? x:y); return(t>=z ? t:z); } void main(){ int x = 10,y=18,maxi; float a = 1.2,b = 3.2,c = 2,max2; max1 = max(x,(int)c); max2 = max(a,b,(float)y); cout<<maxi<<endl; cout<<max2<<endl;A.18 3.2B.10 18C.10 3.2D.编译出错 ” 相关考题
考题 有如下程序:includevoid fun(intx, int y){int t=x; x=y; y=t;}int main(){int 有如下程序: #include<iostream> void fun(intx, int y){int t=x; x=y; y=t;} int main() { int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::end1; return 0; } 执行后的输出结果是( )。A.42,42B.23,23C.23,42D.42,23

考题 有如下程序:include void fun (int x,int y){int t=x;x=y;y=t;}int main(){ int 有如下程序: #include <iostream> void fun (int x,int y){int t=x;x=y;y=t;} int main() { int a[2]={23,42}; fun (a[1],a[0]; std::cout<<a[0]<<”,”<<a[1]<<std:: ond1; retum0; }执行后的输出结果是______ 。A.41,41B.23,23C.13,42D.42,23

考题 有如下程序: include void fun(intx,int y){int t=x;x=y;y=t;} int ma 有如下程序: #include<iostream> void fun(intx,int y){int t=x;x=y;y=t;} int main() { int a[2]={23,42}; fun(a[1],a[0]; std::cout<<a[0]<<","<<a[1]<<std::ndl; return 0; } 执行后的输出结果是A.42,42B.23,23C.23,42D.42,23

考题 有如下程序:include void fun(int x, int y){int t=x;x=y;y=t;}int main (){int 有如下程序: #include <iostream> void fun(int x, int y){int t=x;x=y;y=t;} int main () { int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; } 执行后的输出结果是A.42,42B.23,23C.23,42D.42,23

考题 下面程序的输出结果是()。includeusing namespace std;void swap(int x[2]){int t; t= 下面程序的输出结果是( )。 #include<iostream> using namespace std; void swap(int x[2]) { int t; t=x[0]; x[0]=x[1]; x[1]=t; } void main() { int a[2]={4,8}; swap(a); cout<<a[0]<<" "<<a[1]; }A.4 8B.8 4C.4 4D.8 8

考题 如下程序的输出结果是includevoid fun(int x=y;y=t;}int main(){in 如下程序的输出结果是 #include<iostream> void fun(int & X,inty){intt=x;x=y;y=t;} int main( ){ int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; }A.42,42B.23,23C.23,42D.42,23

考题 下面不属于同一函数模板的是()。A.template t1 max(t1 a,t1 b) {…}template 下面不属于同一函数模板的是( )。A.template<class t1> t1 max(t1 a,t1 b) {…}template<class t2> t2 max(t2 a,t2 b) {…}B.template<class t1>t1 max(t1 a,t1 b){…}template<class t2>t2 max(t2 a,t2 b){…}C.template<class t1> t1 max(t1 * a,t1 * b) {…} template<class t2> t2 max(t2 a,t2 b) {…}D.template<class t1>t1 max(t1 a,t1 b){…}template<class t2>t2 max(t2 a,t2 b,t2 c){…}

考题 下面程序的输出结果是()。includevoid main(){int x=-1,y=5,z;z=(x++ 下面程序的输出结果是( )。#include<iostream.h>void main(){int x=-1,y=5,z;z=(x++<0) (y-->=0);cout<<x<<'\t'<<y<<'\t'<<z<<end1;}A.-1 5 0B.-1 4 1C.0 4 1D.0 4 0

考题 下面属于同一函数模板的是____A.template<class t1> t1 max(t1 a,t1 b) {...} template<class t2> t2 max(t2 a,t2 b) {...}B.template<class t1> t1 max(t1 a,t1 b) {...} template<class t2> t2 max(t2 a,t2 b) {...}C.template<class t1> t1 max(t1 *a,t1 *b) {...} template<class t2> t2 max(t2 a,t2 b) {...}D.template<class t1> t1 max(t1 a,t1 b) {...} template<class t2> t2 max(t