|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h >
void main ()
{
int max(int ,int );
int min (int ,int );
int add (int ,int );
void process (int ,int ,int (*fun)());
int a,b ;
printf ("please input two numbers :\n");
scanf ("%d%d",&a,&b);
process (a,b,max);
process (a,b,min);
process (a,b,add);
}
int add(int x,int y)
{
int z;
z=x+y;
printf ("%d",z);
return z;
}
int min(int x,int y)
{
int z;
if (x>y)
{
z=y;
}
else
{
z=x;
}
printf ("%d",z);
return z;
}
int max(int x,int y)
{
int z;
if (x>y)
{
z=x;
}
else
{
z=y;
}
printf ("%d",z);
return z;
}
--------------------配置: mingw5 - CUI Debug, 编译器类型: MinGW--------------------
检查文件依赖性...
正在编译 C:\Users\susan\Documents\C-Free\Temp\未命名1.cpp...
[Error] C:\Users\susan\Documents\C-Free\Temp\未命名1.cpp:12: error: invalid conversion from `int (*)(int, int)' to `int (*)()'
[Error] C:\Users\susan\Documents\C-Free\Temp\未命名1.cpp:12: error: initializing argument 3 of `void process(int, int, int (*)())'
[Error] C:\Users\susan\Documents\C-Free\Temp\未命名1.cpp:13: error: invalid conversion from `int (*)(int, int)' to `int (*)()'
[Error] C:\Users\susan\Documents\C-Free\Temp\未命名1.cpp:13: error: initializing argument 3 of `void process(int, int, int (*)())'
[Error] C:\Users\susan\Documents\C-Free\Temp\未命名1.cpp:14: error: invalid conversion from `int (*)(int, int)' to `int (*)()'
[Error] C:\Users\susan\Documents\C-Free\Temp\未命名1.cpp:14: error: initializing argument 3 of `void process(int, int, int (*)())'
[Warning] C:\Users\susan\Documents\C-Free\Temp\未命名1.cpp:53:2: warning: no newline at end of file
构建中止 未命名1: 6 个错误, 1 个警告
|
|