自考新教材-p60_3

源程序:

#include <iostream>
#include <cmath>
using namespace std;

int f(int);
int main()
{
int i;
for (i = 0; i < 3; i++)
cout << f(i) << endl;
system("pause");
return 1;
}

int f(int a)
{
int b = 0, c = 1;
b++;
c++;
return int(a + pow(double(b), 2) + c);
}

运行结果:

 

posted @ 2020-02-06 14:19  bobo哥  阅读(140)  评论(0)    收藏  举报