判断体重偏轻重

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

namespace 判断体重偏轻中
{
    class Program
    {
        static void Main(string[] args)
        {                                     
                Console.Write("请输入你的性别:");
                string s = Console.ReadLine();
                Console.Write("请输入你的身高(cm):");
                double a = int.Parse(Console.ReadLine());
                Console.Write("请输入你的体重(kg):");
                double b = int.Parse(Console.ReadLine());
                if (s == "")
                {
                    double c = b - a + 100;
                    if (c <= 3 && c >= -3)
                    {
                        Console.WriteLine("你的体重标准");
                    }
                    else if (c < -3)
                    {
                        Console.WriteLine("你体重偏瘦");
                    }
                    else
                    {
                        Console.WriteLine("你的体重偏胖");
                    }
                }
                else if (s == "")          //此处需要加else,否则将运行显示:输入有误
                {
                    double d = b - a + 110;
                    if (d <= 3 && d >= -3)
                    {
                        Console.WriteLine("你的体重标准");
                    }
                    if (d < -3)
                    {
                        Console.WriteLine("你体重偏瘦");
                    }
                    else
                    {
                        Console.WriteLine("你的体重偏胖");
                    }
                }
                else
                {
                    Console.WriteLine("输入有误");

                }
                Console.ReadLine();
          }
    }
}

 

posted @ 2015-06-18 13:52  蓝瑟黄昏  阅读(161)  评论(0编辑  收藏  举报