执行下列程序段,结果是 #include(iostream.h> void main() { int x=40; char y=‘C’;int n; n=(x&0xff)&&(y>‘B’); cout<<n;}
A.0
B.1
C.2
D.3
第1题:
下面程序的运行结果是
#include<iostream.h>
void fun(int * a,int * b)
{
int x= * a;
* a= * b; * b=X;
cout < < * a < < * b < <" ";
}
void main( )
{
int x=1,y=2;
fun(&x,&y) ;
cout < < X < < y < < endl;
}
A.12 12
B.12 21
C.21 12
D.21 21
第2题:
以下程序的执行结果是______。
include<iostream.h>
class Sample
{
int n;
public:
Sample() {}
Sample (int i (n=i;)
void add (Sample &s1,Sample s2)
{
this->n=sl.n+=s2.n;
}
void disp() {cout<<" n="<< n <<end1:}
}
void main ()
第3题:
阅读下面程序:
include<iostream.h>
void fun(int n)
{
int x(5);
static int y(10);
if(n>0)
{
++x;
++y;
cout<<x<<","<<y<<end1;
}
}
void main()
{
int m(1);
fun(m);
}
则该程序的输出结果是______。
第4题:
以下程序运行后的输出结果是【 】。
include<iostream.h>
void fun(int x,int y)
{ x=x+y;y=x-y;x=x-y;
cout<< x << "," <<y << " ,";}
void main( )
{ int x=2,y=3;fun(x,y);
cout<< x << "," << y << endl;}
第5题:
阅读下列程序:
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);
}
则该程序的输出结果是______。
第6题:
以下程序的执行结果是【 】。
include<iostream.h>
int f(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[]={2,3,4,5,6,7,8,9};
x=f(a,3);
cout<<x<<endl;
}
第7题:
#include<iostream.h> void main( ) { int n=9; while(n>6) { n--; cout < < n;} } 该程序的输出结果是
A.987
B.876
C.8765
D.9876
第8题:
阅读下面程序:
include<iostream.h>
void f(int n)
{
int x(5);
static int y(10);
if(n>0)
{
++x;
++y;
cout<<x<<","<<y<<endl;
}
}
void main()
{
int m(1);
f(m),
}
则该程序的输出结果是【 】
第9题:
以下程序的执行结果是【 】。
include<iostream.h>
include<iomanip.h>
void pnnt(int n)
{
if (n!=0)
{
Print(n-1);
for (int i=1;i<=n;i++)
cout<<setw(3)<<i;
cout<<endl;
}
}
void main()
{
print(4);
}
第10题:
以下程序的执行结果是【 】。
include<iostream.h>
include<stdlib.h>
class Sample
{
public:
int x,y;
Sample(){x=y=0;}
Sample(int a,int b) {x=a;y=b; }
void disp()
{
cout<<"x="<<x<<",y="<<y<<end1;
}
};
void main() {
Sample s1(2,3);
s1.disp();
}