Пример 4
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int a;
cout << "Please input A (>0): ";
cin >> a;
int b;
cout << "Please input B (>0): ";
cin >> b;
int c;
cout << "Please input C (>0): ";
cin >> c;
int m;
if (a > b)
{
if (a > c)
{
//cout << "A is the largest number" << endl;
m = a;
}
else
{
//cout << "C is the largest number" << endl;
m = c;
}
}
else
{
if (b > c)
{
//cout << "b is the largest number" << endl;
m = b;
}
else
{
//cout << "C is the largest number" << endl;
m = c;
}
}
//if (a == b && b == c)
//{
// cout << "A, B and C can form a triangle" << endl;
//}
if (a+b+c-m <= m)
{
cout << "A,B and C cannot form a triangle" << endl;
}
else
{
cout << "A, B and C can form a triangle" << endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
<== попередня сторінка |
| |
наступна сторінка ==> |
Пример 3 | | | Пример 5 | Переглядів: 290
Не знайшли потрібну інформацію? Скористайтесь пошуком google:
|
|