double f(double x) { return 2 * x; } double sum(double (*f)(double d), int n, int m) { double result = 0; for (int i = n; i <=m; i++) { result += f(i); } return result; } int main() { sum(f, 1, 10); }
原文:https://www.cnblogs.com/ms_senda/p/11300238.html