using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.Title = "三角形判断器";
//声明变量
double a, b, c;//a:第一条边 b:第二条边 c:第三条边
string triangle;//triangle:三角形
//输入
Console.WriteLine("请输入第一条边a");
a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第一条边b");
b = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第一条边c");
c = Convert.ToDouble(Console.ReadLine());
//处理
if (a + b > c && a + c > b && b + c > a)
{
if(a == b && b == c)
triangle="该三角形为等边三角形";
else if(a == b || a == c || b == c)
triangle="该三角形为等腰三角形";
else if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a)
triangle="该三角形为直角三角形";
else triangle="该三角形为任意三角形";
}
else triangle="不能构成三角形";
//输出
Console.WriteLine("第一条边为:{0}\t第二条边为:{1}\t第三条边为:{2}\n该三角形为{3}",a,b,c,triangle);
Console.Read();//此处用于输出定格
}
}
}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) {