Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- class triangle
- {
- public:
- int a, b, c, p, P;
- float S;
- void per()
- {
- P = a + b + c;
- cout << "P = " << P << endl;
- p = P / 2;
- }
- void square()
- {
- S = sqrt(p * (p - a) * (p - b) * (p - c));
- cout << "S = " << S;
- }
- };
- int main()
- {
- triangle today;
- cin >> today.a;
- cin >> today.b;
- cin >> today.c;
- today.per();
- today.square();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement