Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // re4(7).cpp
- /* this program calculates the area of a triangle, using heron's formula */
- #include<iostream>
- #include<stdio.h>
- #include<conio.h>
- #include<math.h>
- inline int tricon (float de,float dr,float dt)
- {
- if ( (de+dr>dt) && (dr+dt>de) && (de+dt>dr) )
- {return 25;}
- else {}
- return 0;
- }
- inline float triare (float se,float sr,float st)
- {
- int ss=(se+sr+st)/2;
- int ree=0;
- ree=sqrt((ss-se)*(ss-sr)*(ss-st));
- return ree;}
- using namespace std;
- int main()
- {
- float s1,s2,s3;
- puts(" please enter the sides of the triangle\n ");
- cin>>s1>>s2>>s3;
- if (tricon(s1,s2,s3)==25)
- {cout<< triare(s1,s2,s3);}
- else {cout<< " this is not a proper triangle ";}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement