using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections ; //新定义的
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
#region 求一元二次方程
// public string qiufc(double a,double b,double c,out double jieguo1,out double jieguo2)
//{
// jieguo1 = 0;
// jieguo2 = 0;
// if (a == 0)
// {
// return "no";
// }
// else
// {
// double d = b * b - 4 * a * c;
// double x1 = (-b + Math.Sqrt(d)) / (2 * a);
// double x2 = (-b - Math.Sqrt(d)) / (2 * a);
// if (d >= 0)
// {
// if (d == 0)
// {
// //Console.WriteLine("此方程只有一个根");
// // Console.Write("x1=x2=" + x1.ToString());
// jieguo1 = x1;
// jieguo2 = x2;
// return "yes";
// }
// else
// {
// // Console.WriteLine("此方程有两个不同的根");
// // Console.Write("x1=" + x1.ToString() + " x2=" + x2.ToString());
// jieguo1 = x1;
// jieguo2 = x2;
// return "yes";
// }
// }
// else
// {
// return "no";
// }
// }
// }
#endregion
#region==这是测体重的方法函数==
//输入性别(男或女),身高体重,返回标准、超标、偏瘦、错误四种值
public string cetizhong(string sex,int hight,double weight)
{
if (sex == "男")
{
double bzweight = hight - 100;
double cha = weight - bzweight;
if (cha > 3)
{
return "不好意思,你有点胖了,该减肥了!";
}
else if (cha < -3)
{
return "不好意思,你需要补充营养!";
}
else
{
return "您的身材很标准,继续保持!";
}
}
else if (sex == "女")
{
double bzweight = hight - 110;
double cha = weight - bzweight;
if (cha > 3)
{
return "不好意思,你有点胖了,该减肥了!";
}
else if (cha < -3)
{
return "不好意思,你需要补充营养!";
}
else
{
return "您的身材很标准,继续保持!";
}
}
else
{
return "不知道哪错了,可能是你还没有长大!";
c#推箱子源程序
最新推荐文章于 2022-07-12 21:51:57 发布