Var H1:array[1..5] of integer; H2:array[1..8] of integer; N1:array[1..5] of integer; N2:array[1..8] of integer; i, j:integer;
begin randomize; for i:=1 to 5 do {заполняем массивы} begin H1[i]:=random(10); N1[i]:=random(10); end; for i:=1 to 8 do begin H2[i]:=random(10); N2[i]:=random(10); end; for i:=1 to 5 do {сравниваем продукцию} for j:=1 to 8 do if N1[i]=N2[j] then writeln(i, ' и ', j, ' Выпускают одинаковую продукц.'); write('H1 ');{выводим массивы} for i:=1 to 5 do write(H1[i], ' '); writeln; write('N1 '); for i:=1 to 5 do write(n1[i], ' '); writeln; write('H2 '); for i:=1 to 8 do write(H2[i], ' '); writeln; write('N2 '); for i:=1 to 8 do write(N2[i], ' '); writeln; end.
void TriangleArea(double a, double b, double c) { double p = (a + b + c) / 2; double ss = p * (p - a) * (p - b) * (p - c); // Using Heron's formula if (ss > 0) cout << "Area of triangle = " << sqrt(ss); else cout << "The three sides will not form a triangle."; }
cout << "\n\nThree side lengths to a triangle (a, b, c):\n"; TriangleArea(a, b, c); cout << "\n\nThree side lengths to a triangle (a, b, d):\n"; TriangleArea(a, b, d); cout << "\n\nThree side lengths to a triangle (b, c, d):\n"; TriangleArea(b, c, d); cout << "\n\nThree side lengths to a triangle (a, c, d):\n"; TriangleArea(a, c, d); cout << "\n\n"; }
H2:array[1..8] of integer;
N1:array[1..5] of integer;
N2:array[1..8] of integer;
i, j:integer;
begin
randomize;
for i:=1 to 5 do {заполняем массивы}
begin
H1[i]:=random(10);
N1[i]:=random(10);
end;
for i:=1 to 8 do
begin
H2[i]:=random(10);
N2[i]:=random(10);
end;
for i:=1 to 5 do {сравниваем продукцию}
for j:=1 to 8 do
if N1[i]=N2[j] then writeln(i, ' и ', j, ' Выпускают одинаковую продукц.');
write('H1 ');{выводим массивы}
for i:=1 to 5 do
write(H1[i], ' ');
writeln;
write('N1 ');
for i:=1 to 5 do
write(n1[i], ' ');
writeln;
write('H2 ');
for i:=1 to 8 do
write(H2[i], ' ');
writeln;
write('N2 ');
for i:=1 to 8 do
write(N2[i], ' ');
writeln;
end.
using namespace std;
void TriangleArea(double a, double b, double c)
{
double p = (a + b + c) / 2;
double ss = p * (p - a) * (p - b) * (p - c); // Using Heron's formula
if (ss > 0)
cout << "Area of triangle = " << sqrt(ss);
else
cout << "The three sides will not form a triangle.";
}
void main()
{
double a, b, c, d;
cout << "a = ";
cin >> a;
cout << "b = ";
cin >> b;
cout << "c = ";
cin >> c;
cout << "d = ";
cin >> d;
cout << "\n\nThree side lengths to a triangle (a, b, c):\n";
TriangleArea(a, b, c);
cout << "\n\nThree side lengths to a triangle (a, b, d):\n";
TriangleArea(a, b, d);
cout << "\n\nThree side lengths to a triangle (b, c, d):\n";
TriangleArea(b, c, d);
cout << "\n\nThree side lengths to a triangle (a, c, d):\n";
TriangleArea(a, c, d);
cout << "\n\n";
}