#include
float add(float x,float y)
{return (x+y);}
float sub(float x,float y)
{return (x-y);}
float mul(float x,float y)
{return (x*y);}
float div(float x,float y)
{return (x/y);}
float result(float x,float y,float(*pf)(float,float))
{
float s;
s=(*pf)(x,y);
return s;
}
void main()
{
float a,b,s;
char op;
printf(""please select your operation (input +,-,*or/)\n");
scanf("%c",&op);
printf("please input the two operand\n");
scanf("%f %f",&a,&b);
switch(op)
{
case '+':s=result(a,b,add);break;
case '-':s=result(a,b,sub);break;
case '*':s=result(a,b,mul);break;
case '/':s=result(a,b,div);break;
}
printf("the operation is :%f%c%f=%f\n",a,op,b,s);
}