#include <stdio.h>
#include <math.h>
float jifen_sin(float x);
float jifen_cos(float x);
float jifen_exp(float x);
float process(float x,float (*fun)(float));
int main(int argc, char *argv[])
{
int i;
printf("please input request number(number > 0):");
scanf("%d",&i);
printf("the sin(%d) = %f\n",i,process(i,jifen_sin));
printf("the cos(%d) = %f\n",i,process(i,jifen_cos));
printf("the exp(%d) = %f\n",i,process(i,jifen_exp));
system("pause");
return 0;
}
float jifen_sin(float x)
{
return sin(x);
}
float jifen_cos(float x)
{
return cos(x);
}
float jifen_exp(float x)
{
return exp(x);
}
float process(float x,float (*fun)(float))
{
float result = (*fun)(x);
}
|