#include
int perimeter(int x,int y);
int area(int x,int y);
int solution(int x,int y,int(*ptr)());
int main()
{
int a,b;
printf(" 请输入A和B的值:");
scanf("%d%d",&a,&b);
printf(" Perimeter of a rectangle:");
solution(a,b,perimeter);
printf(" Area of a rectangle:");
solution(a,b,area);
}
int perimeter(int x,int y)
{
return (2*(x+y));
}
int area(int x,int y)
{
return x*y;
}
int solution(int x,int y,int(*ptr)())
{
int result;
result=(*ptr)(x,y);
printf("%d\n",result);
}
[Error] C:\Users\H\Documents\C-Free\Temp\未命名1.cpp:11: error: invalid conversion from int (*)(int, int)' to
int (*)()'