sides of a triangle

can anyone help me with this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include<cmath>
#include<cstdio>

using namespace std;

int main()
{
	double size, x, y, z, p, A, t, rmin1 = 0, rmin2 = 0;	

	cin >> size;
	if( size <= 1000 )
	{
        for(int i = 1 ; i <= size ; i++)
        {
	   cin >> x;
           if(x <= 5000)
	   {
             cin >> y;
             if(y <= 5000)
             {
                  cin >> z;
                  if(z <= 5000)
                  {
                     p = (x + y + z) / 2;    
                     A = sqrt(p * (p-x) * (p-y) * (p-z));
                     if(x < rmin1)
                          x = rmin1;
                     if(y < rmin1)
                          y = rmin1;
     
                     if(y < rmin2)
                          y = rmin2;
                     if(z < rmin2)
                          z = rmin2;
                     t = 0.5 * rmin1 * rmin2;
                     
                     if(A == p){
                          cout << x << " " << y << " " << z;
                          printf(" : RIGHT TRIANGLE WITH AREA %1.5f UNITS SQUARED\n",A);
                          }
                     else if(A != 0){
                          cout << x << " " << y << " " << z;
                          printf(" : TRIANGLE WITH AREA %1.5f UNITS SQUARED\n",A);
                          }
                     else if(A == 0){
                          cout << x << " " << y << " " << z;
                          printf(" : NOT A TRIANGLE\n");
                          }
                  }
             }
          }
             
        }
    
    }
    
	return 0;
}


and this is my output:
3
3 5 4
3 5 4 : RIGHT TRIANGLE WITH AREA 6.00000 UNITS SQUARED
1 2 1
1 2 1 : NOT A TRIANGLE
3 3 1
3 3 1 : TRIANGLE WITH AREA 1.47902 UNITS SQUARED


It should be like this:
3
3 5 4
1 2 1
3 3 1
3 5 4 : RIGHT TRIANGLE WITH AREA 6.00000 UNITS SQUARED 
1 2 1 : NOT A TRIANGLE
3 3 1 : TRIANGLE WITH AREA 1.47902 UNITS SQUARED

Last edited on
learn to google. as you have this from the internet, the answer also is on the internet.
here is a post about this:
http://www.cplusplus.com/forum/unices/76488/
Last edited on
Topic archived. No new replies allowed.