Const n=20; type omas=array[1..n] of integer; Procedure Del (var z:omas; k:byte); var i:byte; begin for i:=k to n-1 do z[i]:=z[i+1]; z[n]:=0; end; var a:omas; i,b:integer; begin Randomize; for i:=1 to n do begin a[i]:=random(20); write(a[i]:4); end; writeln; b:=6; i:=1; while (i<=n)and(a[i]<>b) do i:=i+1; if i<=n then begin Del(a,i); writeln('Размерность массива = ',n-1); for i:=1 to n-1 do write(a[i]:4); writeln; end else writeln('Массив не изменился'); end. Пример: 12 13 6 7 17 1 18 17 3 2 12 3 16 6 7 13 0 2 5 18 Размерность массива = 19 12 13 7 17 1 18 17 3 2 12 3 16 6 7 13 0 2 5 18
using System;
class Program
{
static void Main()
{
int x1 = 2, y1 = 1;
int x2 = 6, y2 = 5;
int x3 = 10, y3 = 1;
var a = Distance(x2, y2, x3, y3);
var b = Distance(x1, y1, x3, y3);
var c = Distance(x2, y2, x1, y1);
Console.WriteLine("S = {0}", Square(a, b, c));
Console.ReadKey();
}
//растояние между точками
static double Distance(int x1, int y1, int x2, int y2)
{
return Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
//формула герона
static double Square(double a, double b, double c)
{
var p = (a + b + c) / 2;
return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
}
// теорема косинусов
static double Angle(double a, double b, double c)
{
return Math.Acos((b * b + c * c - a * a) / (2 * b * c));
}
static bool IsAcuteAngel(double alpha)
{
return alpha < Math.PI / 2;
}
}