begin {ввод массива} if handsfree then n := random(20) + 5 else begin write('n = '); readln(n); end;
writeln('Данные массива:'); for i := 1 to n do begin if handsfree then begin a[i] := random(100) - 50; write(a[i], ' '); end else readln(a[i]); end; writeln();
{изменение элементов} for i := 1 to n do begin if i mod 2 = 0 then a[i] := a[i] / a[2] else a[i] := a[i] * a[1];
write(a[i], ' '); end; end.
kirillboytsov403
26.03.2021
//Dev C++ 4.9.9.2
#include <iostream> #include <cmath> using namespace std;
int main(){ int x1,x2,x3,y1,y2,y3=0; double s,p,a,b,c,pp=0; cin>>x1>>y1>>x2>>y2>>x3>>y3; a=sqrt(pow(float(x2-x1),2)+pow(float(y2-y1),2)); b=sqrt(pow(float(x3-x2),2)+pow(float(y3-y2),2)); c=sqrt(pow(float(x3-x1),2)+pow(float(y3-y1),2)); p=a+b+c; pp=p/2; s=sqrt(pp*(pp-a)*(pp-b)*(pp-c)); cout<<"S="<<s<<endl; cout<<"P="<<p; cin.get(); cin.get(); return 0; }
Пример ввода: 1 1 1 5 6 7 Пример вывода: S=10 P=17.1954