csppass
连续 00 XP登录 / 注册
202430阅读程序函数与递归普及/提高

程序(三):customFunction(5,4) 的返回值

题目

阅读下面的程序,回答问题。 #include <iostream> #include <cmath> using namespace std; int customFunction(int a, int b) { if (b == 0) { return a; } return a + customFunction(a, b - 1); } int main() { int x, y; cin >> x >> y; int result = customFunction(x, y); cout << pow(result, 2) << endl; return 0; } 当输入为“5 4”时,customFunction(5,4)的返回值为( )。

考点拆解
递归函数
易错提醒
阅读程序题要按变量变化顺序手推,不要跳步
选择题要检查单位、边界和题目中的否定词