下面程序的运行结果为【 】。
include<iostream.h>
void fun(intx=0,iot y=0)
{
cout<<X<<y;
}
Void main()
{
fun(5);
}
第1题:
阅读下列程序:
include<iostream.h>
void fun(int n)
{
int x(5);
static int y(10);
if(n>0)
{
++x;
++y;
cout<<x<<","<<y<<endl;
}
}
void main()
int m(1);
fun(m);
}
则该程序的输出结果是______。
第2题:
下面程序的运行结果是______。
include<iostream.h>
void fun(int &a,int b=3)
{
static int i=2;
a=a+b+i;
i=i+a;
}
void main()
{
int x=5,y=2;
fun(x,y);
cout<<x<<",";
fun(x);
cout<<x<<endl;
}
第3题:
下面程序的运行结果是( )。#include<iostream.h>class Sample{int x, y;public:Sample() { x=y=0; }Sample(int a, int b) { x=a; y=b; }void (lisp(){cout<<"x="<<x<<",y="<<y<<end1;}};void main(){Sample s(2,3), *p=&s;p->disp();}
A.x=1, y=2
B.x=2, y=4
C.x=2, y=3
D.x=4, y=3
第4题:
以下程序的执行结果是______。
include<iostream.h>
void main()
{
int x=5 y=2;
cout<<! (y==x/2)<<",";
cout<<(y!=x%3)<<",";
cout<<(x>0 && y<0=<<",";
cout<<(x!=y||x>=y)<<endl;
}
第5题:
下面程序的运行结果为_____。
include<iostream.h>
void fun(int x=0,int y=0)
{
cout < < x < < y;
}
void main( )
{
fun(5) ;
}