键盘输入三角形的三条边,求出三角形的边长。
注意:三角形的形成条件
// variable.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
float fa = 0;
float fb = 0;
float fc = 0;
cout << "请输入三角形的第1条边fa:" << endl;
cin >> fa;
cout << "请输入三角形的第2条边fb:" << endl;
cin >> fb;
cout << "请输入三角形的第3条边fc:" << endl;
cin >> fc;
if (fa + fb > fc && fa + fc > fb && fb + fc > fa)
{
cout << "三角形边长等于:" << fa+fb+fc << endl;
}
else
{
cout << "输入不合法" << endl;
}
system("pause");
return 0;
}