M
M
max volin2020-12-16 21:30:39
C++ / C#
max volin, 2020-12-16 21:30:39

How to write c++ formula (S=2*(ab+ac+bc)?

#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;

double square(double a, double b) //площа прямокутника
{
    return( a*b );
}
double square(double a, double b, double c) //площа повна поверхня прямокутника
{
    return(2(ab+ac+bc );
}

int main()
{
    double a, b, c;
    cout << "Rectangle" << endl; // прямокутник
    cin >> a >> b;
    cout << "S=" << square(a, b) << endl;
    cout << "Triangle" << endl; //прямокутник
    cin >> a >> b >> c;
    cout << "S=" << square(a, b, c) << endl;
    
    system("pause");
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuriy Vorobyov, 2020-12-16
@kamiyada

2*(ab+ac+bc) =2 * (a * b + a * c + b * c)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question