Advertisement
LegoDrifter

Triangle

Apr 2nd, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Triangle{
  6. private:
  7.     int a;
  8.     int b;
  9.     int c;
  10. public:
  11.     Triangle(int a=0,int b=0,int c=0)
  12.     {
  13.     this->a=a;
  14.     this->b=b;
  15.     this->c=c;
  16.     }
  17.     int area(){
  18.     return
  19.     a+b+c;
  20.     }
  21.  
  22. };
  23.  
  24. int main()
  25. {
  26.  
  27.     float a,b,c;
  28.     cin>> a >> b >> c;
  29.     Triangle object(a,b,c);
  30.     cout<< "The perimeter of the triangle is:" << object.area() << endl;
  31.  
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement