为什么一运行就停止工作?
#include <stdio.h>void main()
{
double a, b, result;
printf("Input two numbers:");
scanf("%ld%ld", a, b);
double maximum(double a, double b);
double minimum(double a, double b);
double add(double a, double b);
double multiple(double a, double b, double (*p)());
result = multiple(a, b, maximum);
printf("max = %ld", result);
result = multiple(a, b, minimum);
printf("min = %ld", result);
result = multiple(a, b, add);
printf("add = %ld", result);
}
double maximum(double a, double b)
{
if(b > a)
{
a = b;
}
return a;
}
double minimum(double a, double b)
{
if(b < a)
{
a = b;
}
return a;
}
double add(double a, double b)
{
return(a + b);
}
double multiple(double a, double b, double (*p)())
{
return (*p)(a, b);
}
scanf("%ld%ld", a, b);应该是scanf("%ld%ld", &a,&b);吧
页:
[1]