Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question