为了账号安全,请及时绑定邮箱和手机立即绑定

体积算不出来

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class LaoChi
    {
        class LaoChiV
        {
            double V;                     //蓄水容积
            double H1, S1, S2;      //有效水深、池口水面面积、池底水面面积
            double H2, R1, R2;      //有效水深、池口半径、池底半径
            double H3, Ru;            //有效水深、圆半径
            double H4, R, r;          //有效水深、椭圆长的半径、椭圆短的半径
            public double JuXingLC()
            {
                Console.WriteLine("请分别输入有效水深、池口的水面面积、池底的水面面积:");
                H1 = double.Parse(Console.ReadLine());
                S1 = double.Parse(Console.ReadLine());
                S2 = double.Parse(Console.ReadLine());
                Console.WriteLine("矩形涝池蓄水容积V: {0} ",V=1 / 2 * H1 * (S1 + S2));
                return V;
            }
            public double PdyuanxingLC()
            {
                Console.WriteLine("请分别输入有效水深、池口半径、池底的半径:");
                H2 = double.Parse(Console.ReadLine());
                R1 = double.Parse(Console.ReadLine());
                R2 = double.Parse(Console.ReadLine());
                Console.WriteLine("平底圆形涝池蓄水容积V: {0} ", V = 3.14 / 2 * (R1 + R2) * H2);
                return V;
            }
            public double UzixingLC()
            {
                Console.WriteLine("请分别输入有效水深、圆的半径:");
                H3 = double.Parse(Console.ReadLine());
                Ru = double.Parse(Console.ReadLine());
                Console.WriteLine("‘U’字形涝池蓄水容积V: {0} ", V = 3 / 5 * 3.14 * Ru * H3);
                return V;
            }
            public double TuoyuanxingLC()
            {
                Console.WriteLine("请分别输入有效水深、椭圆长的半径、椭圆短的半径:");
                H4 = double.Parse(Console.ReadLine());
                R = double.Parse(Console.ReadLine());
                r = double.Parse(Console.ReadLine());
                Console.WriteLine("椭圆形涝池蓄水容积V: {0} ", V = 2 / 3 * 3.14 * (R - r) * H4);
                return V;
            }
            static void Main(string[] args)
            {
                LaoChiV lv = new LaoChiV();
                lv.JuXingLC();
                lv.PdyuanxingLC();
                lv.UzixingLC();
                lv.TuoyuanxingLC();
            }
        }
    }
}


正在回答

1 回答


你将计算公式的第一个数字变成浮点型就可以了,Console.WriteLine("矩形涝池蓄水容积V:{0}", V = 1.0 / 2 * H1 * (S1 + S2)

0 回复 有任何疑惑可以回复我~
#1

慕UI1157668 提问者

懂了,谢谢!
2017-01-12 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

体积算不出来

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信