选择题 16.  有如下程序:
    #include<iostream>
    using namespace std;
    int f(int x);
    int sum(int n)
    {
    int x, s=0;
    for(x=0; x<=n; x++)
    s+=f(x);
    return s;
    }
    int f(int x){return(x*x+1);}
    int main()
    {
    int a, b;
    cout<<"Enter a integer number:";
    cin>>a;
    b=sum(a);
    cout<<"a="<<a<<", b="<<b<<endl;
    return 0;
    }
    如果输入数字3,其输出结果是______。
【正确答案】 C
【答案解析】 按照sum函数的功能,若输入a的值为3,则for循环,1次,函数f调用4次,b的值为0+(0^2+1)+(1^2+1)+(2^2+1)+(3^2+1)=18。