C语言哪里错了?照着书敲的。求x1*x1+x1*x2

C语言错哪了?照着书敲的。求x1*x1+x1*x2
#include<stdio.h>
double f1(double x)
{
 return x*x;
}
double f2(double x,double y)
{
 return x*y;
}
double fun(double a,double b)
{
 double (*f)();
 double r1,r2;
 f=f1;
 r1=(*f)(a);
 f=f2;
 r2=(*f)(a,b);
 return r1+r2;
}
void main()
{
 double x1,x2,r;
 printf("请输入x1x2:");
 scanf("%lf%lf",&x1,&x2);
 r=fun(x1,x2);
 printf("x1=%.2f,x2=%.2f,x1*x1+x1*x2=%.2f\n",x1,x2,r);
}

--------------------Configuration: P2256_16函数指针 - Win32 Debug--------------------

Compiling...
7.cpp
c:\users\acer\desktop\p2256_16函数指针\7.cpp(14) : error C2440: '=' : cannot convert from 'double (__cdecl *)(double)' to 'double (__cdecl *)(void)'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\users\acer\desktop\p2256_16函数指针\7.cpp(15) : error C2197: 'double (__cdecl *)(void)' : too many actual parameters
c:\users\acer\desktop\p2256_16函数指针\7.cpp(16) : error C2440: '=' : cannot convert from 'double (__cdecl *)(double,double)' to 'double (__cdecl *)(void)'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\users\acer\desktop\p2256_16函数指针\7.cpp(17) : error C2197: 'double (__cdecl *)(void)' : too many actual parameters
c:\users\acer\desktop\p2256_16函数指针\7.cpp(24) : error C2065: 'sanf' : undeclared identifier
执行 cl.exe 时出错.
P2256_16函数指针.exe - 1 error(s), 0 warning(s)


刚刚在百度提问说问题违规还被删了C语言哪里错了?照着书敲的。求x1*x1+x1*x2
------解决思路----------------------
既然是C语言而不是C ,请楼主将你的源代码文件名后缀由.cpp改为.c