阅读下面程序Private Function a (load As Integer)As SingleIf loud<20 thenmoney=lnad/2elsemoney=20+loadend ifa=moneyEnd FunctionPrivate Sub Form_Click()Dim load As Integer,fee As SingleLoad=InputBox("请输入一个数:")Fee=a(loa@D@Print feeEnd Sub运行后的输出结果是【 】。

题目

阅读下面程序

Private Function a (load As Integer)As Single

If loud<20 then

money=lnad/2

else

money=20+load

end if

a=money

End Function

Private Sub Form_Click()

Dim load As Integer,fee As Single

Load=InputBox("请输入一个数:")

Fee=a(loa@D@Print fee

End Sub

运行后的输出结果是【 】。


相似考题
参考答案和解析
正确答案:40
40 解析:本题的事件过程非常简单,输入数据,调用通用函数过程的输出返回函数值。本题调用通用函数过程,进行虚实结合后load的值为20,执行a函数时,首先判断load20条件为假,执行money-20+load,使money的值为40,接着执行a=money语句,使函数名的值为40,执行到语句End Function则返回调用它的事件过程,将函数值赋给变量fee,最后输出变量fee的值,其值为40。
更多“阅读下面程序Private Function a (load As Integer)As SingleIf loud<20 thenmoney=lnad/2elsemo ”相关问题
  • 第1题:

    下面这个程序的结果是includeclass A{private:int a;public:void seta( );int geta

    下面这个程序的结果是 #include<iostream.h> class A { private: int a; public: void seta( );int geta( );}; void A::seta( ) { a = 1;} int A::geta( ) {return a;} class

    A.1

    B.2

    C.随机输出1或2

    D.程序有错


    正确答案:D
    解析:在类A中有geta()函数,在类B中也有geta()函数,类C继承了类A和类B,这样就产生了二义性,所以程序会出错。

  • 第2题:

    运行以下程序时,由键盘为变量load输入的数据为20,输出结果为______。 Private Function Wei(load As Integer),Money As Single If load<20 Then Money=load/2 Else Money=20+load End if Wei=Money End Function Private Sub Form. _Click() Dim load As Integer,fee As Single load=InputBox(“请输入一个数:”) fee=Wei(loaD)Print fee End Sub

    A.10

    B.20

    C.30

    D.40


    正确答案:D
    解析:本题的程序中调用通用函数过程,当进行虚实结合后,变量load的值为20。当执行Wei函数时,首先判断条件load20为假,执行语句Money=20+load,使Money的值为40,接着执行语句Wei=Money,使函数名的值为40,执行到语句EndFunction则返回到调用它的事件过程,将函数值赋给变量fee,最后输出变量fee的值40。

  • 第3题:

    下面程序的结果是 include class test{private: int num; publi

    下面程序的结果是 #include<iostream.h> class test{ private: int num; public: test( ); int getint( ) {return num;} ~test( );}; test::test( ) { num=0;} test::~test( ) { cout<<"Destructor is active"<<endl;} void

    A.Exiting main Destructor is active Destructor is active Destructor is active

    B.Exiting main Destructor is active Destructoris active

    C.Exiting main Destructoris active

    D.Exiting main


    正确答案:A
    解析:C++语言中析构函数是在程序退出不用该类的对象时进行调用。

  • 第4题:

    下面程序的结果为includeint c;class A{private:int a;static int b;public:A( ){a

    下面程序的结果为 #include<iostream.h> int c; class A { private: int a; static int b; public: A( ) {a=0;c=0;} void seta( ){a++;} void setb( ){b++;}

    A.1 2 1

    B.1 2 2

    C.1 1 2

    D.2 2 2


    正确答案:B
    解析:C++语言中全局变量是任何函数都可以改变的量,静态变量的有效范围在定义它的类中,而普通的变量的有效性只在使用它的函数中,在本题中c为全局变量,b为静态变量,a为普通变量,b和c在类A的对象a1和a2中都自加1。所以b,c为 2,a为1。

  • 第5题:

    阅读下面程序:include template class TAdd{private:T x, y;public:TAdd(T

    阅读下面程序:

    include <iostream.h>

    template <class T>

    class TAdd

    {

    private:

    T x, y;

    public:

    TAdd(T a, T b)

    {

    x=a;

    y=b;

    }

    T add()

    {

    return x +y;

    }

    };

    void main( )

    {

    TAdd<int>a(5,6);

    TAdd<double>b(2.4,5.8);

    cout<<"s1 ="<<A. add()<<",";

    cout<<"s2="<<B, add()<<end1;

    }

    写出该程序的运行结果:【 】。


    正确答案:s1=11s2=8.2
    s1=11,s2=8.2