填空题 下列程序的执行结果是{{U}} 【7】 {{/U}}。 include <iostream. h> int a; int sum_a(void) { a=a+5; return a; } void main(void) { a = a+sum_a(); cout<<a<<endl; }
  • 1、
【正确答案】 1、10    
【答案解析】[解析] 本题考查全局变量的使用。全局变量被系统默认初始化为0,故在执行a=a+sum _a();语句时,首先执行sum_a函数,将a的值改变为5,该函数的返回值也是5,故最后a的值被赋值为10。