69,371
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
void main()
{
int Max(int one, int two);
int Min(int one, int two);
int Add(int one, int two);
void process(int one, int two, int(*fan)());
int one, two;
scanf("%d%d", &one, &two);
printf("Max = ");
process(one, two, Max);
printf("\nMin = ");
process(one, two, Min);
printf("\nAdd = ");
process(one, two, Add);
printf("\n");
}
int Max(int one, int two)
{
int sum;
if (one < two)
{
sum = two;
}
else
{
sum = one;
}
return sum;
}
int Min(int one, int two)
{
int sum;
if (one < two)
{
sum = one;
}
else
{
sum = two;
}
return sum;
}
int Add(int one, int two)
{
int sum;
sum = one + two;
return sum;
}
void process(int one, int two, int(*fan)())
{
int p1, p2, p3;
p1 = (*fan)(one, two);
p2 = (*fan)(one, two);
p3 = (*fan)(one, two);
}
#include <stdio.h>
void main()
{
int Max(int one, int two);
int Min(int one, int two);
int Add(int one, int two);
int process(int one, int two, int(*fan)() );
int one, two;
scanf("%d%d", &one, &two);
printf("Max = %d", process(one, two, Max) );
printf("\nMin = %d", process(one, two, Min) );
printf("\nAdd = %d", process(one, two, Add) );
printf("\n");
}
int Max(int one, int two)
{
int sum;
if (one < two)
{
sum = two;
}
else
{
sum = one;
}
return sum;
}
int Min(int one, int two)
{
int sum;
if (one < two)
{
sum = one;
}
else
{
sum = two;
}
return sum;
}
int Add(int one, int two)
{
int sum;
sum = one + two;
return sum;
}
int process(int one, int two, int(*fan)())
{
return (*fan)(one, two);
}
int process(int one, int two)
{
static int s = 0;
int r = 0;
switch (s)
{
case 0: r = one > two ? one : two; break;
case 1: r = one < two ? one : two; break;
case 2: r = one + two; break;
}
++s;
return r;
}