标题:程序有点问题,最后输出的值总是0,请帮我修改一下!
只看楼主
杨为丰
Rank: 2
等 级:论坛游民
帖 子:17
专家分:16
注 册:2013-4-10
结帖率:25%
已结贴  问题点数:20 回复次数:3 
程序有点问题,最后输出的值总是0,请帮我修改一下!
using System;
using System.Windows.Forms;
public class bijiaodaxiao
{
    public float a;
    public float b;
    public float c;

    public bijiaodaxiao()
    {
        string output = "请输入三个浮点数:";
        Console.WriteLine(output);
      float   a = float.Parse(Console.ReadLine());
       float   b = float.Parse(Console.ReadLine());
      float   c = float.Parse(Console.ReadLine());
    }
    public float   minimum3(out float x, out float y, out float z)
    {
      
        
        x = a;
        y = b;
        z = c;
        if (x <= y)
        {
            if (x <= z)
                return x;
            else
                return z;
        }
        else
        {
            if (y <= z)
                return y;
            else
                return z;
        }
    }
}
public class ywf
{
    static void Main()
    {
        bijiaodaxiao abijiaodaxiao = new bijiaodaxiao();
        float  x1;
       float  y1;
        float  z1;
      
        string output = "最小浮点数为:";
        abijiaodaxiao.minimum3(out x1, out y1, out z1);

       Console.WriteLine(output);

    }
}



        
            
   
搜索更多相关主题的帖子: public public 
2013-04-13 11:15
yhlvht
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:36
帖 子:707
专家分:4405
注 册:2011-9-30
得分:7 
public class bijiaodaxiao
    {
        public float a;
        public float b;
        public float c;

        public bijiaodaxiao()
        {
            string output = "请输入三个浮点数:";
            Console.WriteLine(output);
            a = float.Parse(Console.ReadLine());
            b = float.Parse(Console.ReadLine());
            c = float.Parse(Console.ReadLine());
        }
        public float minimum3(out float x, out float y, out float z)
        {
            x = a;
            y = b;
            z = c;
            if (x <= y)
            {
                if (x <= z)
                    return x;
                else
                    return z;
            }
            else
            {
                if (y <= z)
                    return y;
                else
                    return z;
            }
        }
    }

public class ywf
    {
        static void Main(string[] args)
        {
            bijiaodaxiao abijiaodaxiao = new bijiaodaxiao();
            float x1;
            float y1;
            float z1;

            string output = "最小浮点数为:";
            float result = abijiaodaxiao.minimum3(out x1, out y1, out z1);

            Console.WriteLine(output + result);
        }
    }
2013-04-13 11:43
party620
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:18
帖 子:696
专家分:2521
注 册:2013-1-31
得分:7 
学习
2013-04-13 14:42
vecent
Rank: 2
等 级:论坛游民
帖 子:19
专家分:29
注 册:2013-4-10
得分:7 
版主果然是大神啊
2013-04-13 18:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-404068-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.735236 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved