Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- class Triangle{
- private:
- int a;
- int b;
- int c;
- public:
- Triangle(int a,int b,int c)
- {
- this->a=a;
- this->b=b;
- this->c=c;
- }
- int L(){
- return
- a+b+c;
- }
- int P(){
- return sqrt(((a+b+c)/2)*(((a+b+c)/2)-a)*(((a+b+c)/2)-b)*(((a+b+c)/2)-c));
- }
- };
- int main()
- {
- float a,b,c;
- cin>> a >> b >> c;
- Triangle object(a,b,c);
- cout<< "The area of the triangle is:" << object.P() << endl;
- cout<< "The perimeter of the triangle is:" << object.L() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement