计算男女的身体状况

 

  static void Main(string[] args)
        {
            while (true)
            {
                string xb; double sg, tz,m;
:                Console.Write("请输入您的性别:");                                                    //利用逻辑运算符?:来测算体重,先判断性别。(?;)如果是男的话用100,女的话用110
                xb=Console.ReadLine();
                Console.Write("请输入您的身高:");
                sg = Convert.ToDouble(Console.ReadLine());
                Console.Write("请输入您的体重:");
                tz = Convert.ToDouble(Console.ReadLine());
                int x=(xb=="男"?100:110);
                m = tz - sg + x;
                Console.WriteLine(m>3?"您该减肥了":m<-3?"您该增加营养":"体重正常");

             
                
                            
                Console.ReadLine();
            }
        }

posted @ 2015-03-27 14:23  耿鹏飞  阅读(118)  评论(0编辑  收藏  举报