测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A22432. 执行下列的C++代码段,当x=6时,函数的返回值为( )。int cal(int x){ if(x==0||x==1||x==2){ return 1; } else{ return cal(x-1)+cal(x-2)+cal(x-3); } }

单选题 较易

题目描述

执行下列的C++代码段,当x=6时,函数的返回值为(    )。

int cal(int x){
    if(x==0||x==1||x==2){
        return 1;
    }
    else{
        return cal(x-1)+cal(x-2)+cal(x-3);
    }
}

选项(单选)

上一题 下一题