单项选择题

下列程序的执行结果是( )。
#include<iostream.h>
int fun(int b[],int n)

int i,r=1;
for(i=0;i<n;i++)
r=r*b[i];
return r;

void main()

int x,a[]=1,2,3,4,5,6,7,8;
x=fun(a,3);
cout<<x<<end1;

A.5
B.6
C.7
D.8
<上一题 目录 下一题>
热门 试题

问答题
下列程序的执行结果是( )。 #include<iostream.h> class Sample int x,y; public: Sample() x=y=0; Sample(int a,int b) x=a;y=b; ~Sample() if(x==y) cout<< x=y <<end1; else cout<< x!=y <<end1; void disp() cout<< x= <<x<< ,y= <<y<<end1; ; void main() Sample s1(2,3); s1.disp();
单项选择题
下列程序的输出结果是( )。 #include<iostream> using namespace std; int main() char a[]= Hello,Test ; char *p=a; while(*p) if(*p>=’a’&&*p<=’’z’) cout<<char(*p+’A’-’a’); else cout<<*p; p++; return 0;
A.hello,test
B.Hello,Test
C.HELLO,TEST
D.hELLO,tEST
相关试题
  • 有如下程序: #include<iostream> usi...
  • 下面是一个栈类的模板,其中push函数将元素...
  • 已知下列程序的输出结果是42,请将横线处...
  • 多态性分为两类:编译时的多态性和____...
  • 若,将一个二元运算符重载为类的成员函数,...