Created
June 3, 2012 11:13
-
-
Save kaneshin/2863072 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int | |
integrate | |
( | |
int a, | |
int b, | |
double (*f)(double *, int), | |
int n | |
) | |
{ | |
// 区間[a,b]に対して関数fを積分する | |
// fが関数のポインタなんで、色々な関数をセットできる。 | |
} | |
double | |
f1(double *x, int n) { | |
// define f1 | |
} | |
double | |
f2(double *x, int n) { | |
// define f2 | |
} | |
int | |
main(int argc, char* argv[]) { | |
printf("%f\n", integrate(0, 1, f1, n)); | |
printf("%f\n", integrate(0, 1, f2, n)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment