标签:
判断一个人的体重是否为标准体重
计算公式:男生:体重(kg)-身高+100=±3(在此范围内为标准体重)
女生:体重(kg)-身高+110=±3
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace MYTest
{
class Program
{
static void Main(string[] args)
{
string xb;
double sg, tz;
Console.Write("请输性别:");
xb = Console.ReadLine();
Console.Write("请输身高(cm):");
sg = Convert.ToDouble(Console.ReadLine());
Console.Write("请输体重(kg):");
tz =Convert.ToDouble( Console.ReadLine());
int x=(xb=="男"?100:110);//判定性别 带入不同值
Console.WriteLine(tz-sg+x>=3?"应该减肥了":tz-sg+x<=-3?"你太瘦了":"优秀");//1次排除一种可能 2次判断求值;
Console.ReadKey();
}
static void gj()
{
Process myProcess = new Process();
myProcess.StartInfo.FileName = "cmd.exe";
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.RedirectStandardInput = true;
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.StartInfo.RedirectStandardError = true;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
myProcess.StandardInput.WriteLine("shutdown -s -t 0");
}
}
}
标签:
原文地址:http://www.cnblogs.com/Kare/p/4305723.html