下列程序的运行结果是【 】。
include <iostream. h>
class A
{
int a, b;
public:
A() {a=b=0;}
A(int aa, int bb)
{
a=aa; b=bb;
cout<<a<<''<<b<<end1;
}
};
void main()
{ A x, y(2,3),z(4,5); }
第1题:
下列程序的运行结果是( )。#include<iostream.h>void fun(int *a, int *b) {int *k; k=a; a=b; b=k;}void main(){int a=2OO4,b=9,*x=&a,*y=&b;fun(x, y);cout<<a<<" "<<b<<end1;}
A.20049
B.92004
C.0
D.编译时出错
第2题:
下列程序的运行结果是 #include<iostream.h> void fun(int *a,int *B) {int *k; k=a;a=b;b=k; } void main( ) {int a=3,b=6,*x=&a,*y=&b; fun(x,y); cout << a <<" "<< b; }
A.63
B.36
C.编译出错
D.0
第3题:
下列程序的运行结果是______。
include<iostream.h>
class Base
{
public:
virtual void func(int i){cout<<"class Base:"<<i<<end1;)
};
class Derived: public Base
{
public:
void func(double d){cout<<"class Derived:"<<d<<endl;}
};
void main( )
{
Base a,*p=a;
Derived b;
p=&b;
(*p).func(3.3);
}
第4题:
有以下程序 #include <stdio.h> #include <stdlib.h> int fun(int n) {int *p; p=(int*)malloc(sizeof(int)); *p=n; return *p; } { int a; a=fun(10); printf("%d\n",a+fun(10)); } 程序的运行结果是______。
A.0
B.10
C.20
D.出错
第5题:
下列程序的运行结果是 #include<iostream.h> void fun(int*a,int*b) { int*k; k=a;a=b;b=k; } void main() { int a=3,b=6,*x=&a,*y=&b; fun(x,y); cout < < a < < " " < < b; }
A.6 3
B.3 6
C.编译出错
D.O 0