凉石 发表于 2014-2-26 01:01:58

这个程序有问题啊

#include <stdio.h>
double min(double a, double b);
int main(void)
{
        double x, y;
        printf ("Enter two numbers (q to quit): ");
        while (scanf("%lf %lf", &x, &y) == 2)
    {
      printf("The smaller number is %lf.\n", min(x, y));
      printf("Next two values (q to quit): ");
    }
    printf ("Bye!\n");

    return 0;

}
double min(double a, double b)
{
        if (a < b)
                return a;
        else
                return b;
}

machimilk 发表于 2014-2-26 03:09:00

没问题啊,你输入2个数中间要带空格 ,另外你printf("The smaller number is %lf.\n", min(x, y));
把lf后面的.去掉就更好了
页: [1]
查看完整版本: 这个程序有问题啊