Answer to Question #280025 in C++ for lukaquto

Question #280025
Write a program that calculates the sum of the squares of the sides of a triangle
1
Expert's answer
2021-12-15T16:23:19-0500
#include <iostream>

class tringle
{
    double side_a;
    double side_b;
    double side_c;
public:
    tringle(double a, double b, double c): side_a(a), side_b(b), side_c(c)
    {
        double result = side_a * side_a + side_b * side_b + side_c * side_c;
        std::cout<<"Result: "<< result<< std::endl;
    }
};
int main()
{
    
    tringle(4.5, 6.7, 2.3);
    
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog