С++ ! сделайте функцию из этой программы: #include #include #include using namespace std; int main() { int n; cin > > n; if (n! =3){ double x1; double y1; double x2; double y2; double x3; double y3; cin > > x1 > > y1 > > x2 > > y2 > > x3 > > y3; double a = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); double b = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3)); double c = sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1)); double p = (a + b + c) / (double)2; double s = sqrt(p*(p-a)*(p-b)*(p-c)); cout < < setprecision(6)< < fixed < < s; } if (n! =6){ double a; double b; double c; cin > > a > > b > > c; double p = (a + b + c) / (double)2; double s = sqrt(p*(p-a)*(p-b)*(p-c)); cout < < setprecision(6)< < fixed < < s; } return 0; }

Amigo222288 Amigo222288    2   10.09.2019 00:20    0

Ответы
StePAHka228 StePAHka228  09.09.2020 23:15
#include <iostream>
#include <iomanip>
using namespace std;
void Fun(int n)
{
if (n != 3)
{
 double x1; double y1; double x2; double y2; double x3; double y3;
 cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
 double a = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
 double b = sqrt((x2 - x3)*(x2 - x3) + (y2 - y3)*(y2 - y3));
 double c = sqrt((x3 - x1)*(x3 - x1) + (y3 - y1)*(y3 - y1));
 double p = (a + b + c) / (double)2;
 double s = sqrt(p*(p - a)*(p - b)*(p - c));
 cout << setprecision(6) << fixed << s;
}
if (n != 6)
{
 double a; double b; double c;
 cin >> a >> b >> c;
 double p = (a + b + c) / (double)2;
 double s = sqrt(p*(p - a)*(p - b)*(p - c));
 cout << setprecision(6) << fixed << s; }
}
int main()
{
int n;
cin >> n;
Fun(n);
return 0;
}
ПОКАЗАТЬ ОТВЕТЫ
Другие вопросы по теме Информатика