有如下程序:includeusing namespace std;int fun(int a, int b){return(++a*b++);}vo有如下程序: #include<iostream> using namespace std; int fun(int a, int b) {return(++a*b++);} void main() { int x=3,y=4,z=5,r; r=fun (fun (x,y),z); cout<<r>>endl; cout<<x<<endl; cout<<y<<

题目
有如下程序:includeusing namespace std;int fun(int a, int b){return(++a*b++);}vo

有如下程序: #include<iostream> using namespace std; int fun(int a, int b) {return(++a*b++);} void main() { int x=3,y=4,z=5,r; r=fun (fun (x,y),z); cout<<r>>endl; cout<<x<<endl; cout<<y<<endl; } 该程序的输出的结果是( )。

A.85 3 4

B.60 3 4

C.126 4 5

D.85 4 5


相似考题
更多“有如下程序:#include<iostream>using namespace std;int fun(int a, int b){return(++a*b++);}vo ”相关问题
  • 第1题:

    有以下程序 include include int fun(int n) {int *

    有以下程序 #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.出错


    正确答案:C
    解析:malloc(sizeof(int))的作用是开辟一个长度为sizeof(int)存储空间,并通过强制类型转换(int*)将此存储空间的地址赋给了—个整型的指针变量p。然后执行语句“*p=n”,使得*p的值为10,并通过返回此值,在主函数中输出a+10的值,即输出20。

  • 第2题:

    以下程序的输出结果是#include "stdio.h"int *fun(int *a,int *b){ int m; m=*a; m+=*b-3; return(&m);}main(){ int x=21,y=35,*a=&x,*b=&y; int *k; k=fun(a,b); printf("%d\n",*k);}


    正确答案:53
    本题考查指针函数的使用。题目给出的程序包括两个部分,一个为指针函数fun,一个为主函数main。主函数main部分给出两个整型变量x和y,并给出相应的赋值。main函数的执行结果为输出*k的值,而*k的值即*fun的值。fun函数包括两个整型指针形参*a和*b。通过对*a、*b进行操作,得到结果m,并将m值返回,整个程序的实际输出即为m的值。初始时,m=*a=21。随后令m=m+*b-3,得m=53。整个程序的输出结果即为53。

  • 第3题:

    调试下列程序,写出输出结果,并解释输出结果 #include <iostream> using namespace std; int main() { void fun(int, int&); int a, b; fun(2, a); fun(3, b); cout << "a + b = " << a + b << endl; return 0; } void fun(int m, int &n) { n = m + 4; }


    GFEDCB。 开始指针cp指向字符串结束标志,在循环中,cp依次向前移动,当打印出第二个字符后,cp指向第一个字符,循环判断条件不满足,退出循环,因此,只打印出第一个字符以后的字符的逆序列。

  • 第4题:

    下面程序的输出结果是()。include using namespace std;int fun (int, int);//fun ( )

    下面程序的输出结果是( )。 #include <iostream> using namespace std; int fun (int, int); //fun ( ) 函数的说明 void main( ) { int a =48,b =36,c; c = fun(a,B) ; cout<<c; } int fun(int u,int v) { int w; while (v) {w=u%v;u =v;v =w;} return u; }

    A.24

    B.12

    C.48

    D.36


    正确答案:B
    解析:注意运算符%的特点。

  • 第5题:

    下列程序运行后的输出结果是()。includevoid fun(int,int,int*);void main(){int x,

    下列程序运行后的输出结果是( )。 #include<iostream.h> void fun(int,int,int*); void main() { int x,y,z; fun(5,6,&x); fun(7,x,&y); fun(x,y,&z); cout<<x<<","<<y<<","<<z<<endl; } void fun(int a,int b,int *c) { b+=a; *c=b-a; }

    A.5,5,5

    B.6,6,6

    C.5,6,7

    D.7,7,7


    正确答案:B
    解析:由程序中的main函数入手,分别调用fun函数,第一个调用中x参数为引用地址,调用后x的值为6,因为参数为地址,所以第二个调用中的x参数值为6,调用后y的计算结果为6。同理,z在第三个函数调用后z的值为6。