// Copyright (c) 2014软件技术1班
// All rights reserved.
// 作 者:A42覃燕玲
// 完成日期:2014年 11 月 3 日
// 版 本 号:v1.0
//
// 问题描述:创建一个程序来判断三角形。
// 输入描述:三条边的边长
// 程序输出:三角形的性质
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace qin7
{
class Program
{
static void Main(string[] args)
{
double a,b,c; //边长
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<=0||b<=0||c<=0) //防止输入错误数值
{
Console.WriteLine("输入错误");
Console.Read();
}
if (a + b > c && a + c > b && b + c > a) //判断是否为三角形
{
if (a == b && b == c)
{ Console.WriteLine("是等边三角形");
Console.Read(); }
else if (a == b || b == c || a == c)
{ Console.WriteLine("是等腰三角形");
Console.Read(); }
else if ((a * a) + (b * b) == (c * c) || (a * a) + (c * c) == (b * b) || (b * b) + (c * c) == (a * a))
{
{
Console.WriteLine("是直角三角形");
Console.Read();
}
if (a == b || b == c || a == c)
{
Console.WriteLine("是等腰直角三角形");
Console.Read();
}
}
else
{
Console.WriteLine("是任意三角形");
Console.Read();
}
}
else
{
Console.WriteLine("输入的三边不能组成三角形");
Console.Read();
}
}
}
}