第20799题 单选题
补全高精度整数相加C++代码的空缺内容

下面的代码片段用于将两个高精度整数进行相加,请在横线处填入正确内容,使其能正确实现相应功能。

1 string add(string num1, string num2) {
2  string result;
3  int carry = 0;
4  int i = num1.size() - 1, j = num2.size() - 1;
5  while (i >= 0 || j >= 0 || carry) {
6   int x = (i >= 0) ? num1[i--] - '0' : 0;
7   int y = (j >= 0) ? num2[j--] - '0' : 0;
8   int sum = x + y + carry;
9   carry = sum / 10;
10  // 待填空缺位置
11 }
12  return result;
13 }
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析