I have been working on this source code, but nothing seems to go right. A revised source code would be extremely appreciated, or at least a visual solution to my errors.
Here is the following problem: Write a program that reads three edges for a triangle and determines whether the input is valid. The input is valid if the sum of any two edges is greater than the third edge. Here are the sample runs of this program: Enter three edges 1, 2.5, 1 [Enter] Can edges 1, 2.5, and 1 form a triangle? false
Here is what I have so far for the source code":
#include <iostream>
using namespace std;
bool Valid (int tri_a, int tri_b, int tri_c);
bool triangle;
int main ()
{
int a;
int b;
int c;
cout << "Enter three edges: ";
double edge1, edge2, edge3;
cin >> edge1 >> edge2 >> edge3;
bool isValid = (edge1 + edge2 > edge3) &&
(edge1 + edge3 > edge2) && (edge3 + edge2 > edge1);
cout << " Enter the 1st value: ";
cin >> a;
cout << " Enter the 2nd value: ";
cin >> b;
cout << " Enter the 3rd value: ";
cin >> c;
bool triangle = Valid (a, b, c);
{
if (triangle == true)
cout << "valid" << endl;
else
cout << "invalid" << endl;
}
system ("pause");
return 0;
}