#1:
const
Count = 3; // количество проверяемых чисел
var
m : array [1..Count] of Integer;
i, e, c: Integer;
begin
Writeln('Введите числа:');
for i := 1 to Count do
begin
Write(i ,': '); Readln( m[i] );
end;
for i := 1 to Count do
for e := 1 to Count do
if m[i] < m[e] then
begin
c := m[i];
m[i] := m[e];
m[e] := c;
end;
for i := 1 to Count do
Write(m[i], ' ');
Readln;
end.
#2:
var
a, b, c, x, y: Integer;
begin
Writeln('Введите рёбра кирпича:');
Write('a: '); Readln( a );
Write('b: '); Readln( b );
Write('c: '); Readln( c );
Writeln('Введите стороны отверстия:');
Write('x: '); Readln( x );
Write('y: '); Readln( y );
x := x*y;
if (a*b <= x) or (a*c <= x) or (b*c <= x) then
Write('Пройдёт.')
else
Write('не пройдёт.');
Readln;
end.
Объяснение:
#include <ctime>
#include <cstdlib>
#include <iomanip>
#include <iostream>
using namespace std;
int max_row(int **a, int m, int c) {
int mr = 0;
for (int r = 1; r < m; ++r) if (a[mr][c] < a[r][c]) mr = r;
return mr;
}
int main() {
srand(time(0));
cout << "m n? ";
int m, n; cin >> m >> n;
cout << "\n матрица: \n";
int **a = new int *[m];
for (int r = 0; r < m; ++r) {
a[r] = new int[n];
for (int c = 0; c < n; ++c) cout << setw(4) << (a[r][c] = rand() % 1000);
cout << endl;
}
int mc = 0, mr = max_row(a, m, 0);
cout << "\n максимумы в столбцах: \n" << setw(4) << a[mr][0];
for (int c = 1; c < n; ++c) {
int cmr = max_row(a, m, c);
cout << setw(4) << a[cmr][c];
if (a[mr][mc] > a[cmr][c]) {
mc = c;
mr = cmr;
}
}
cout << "\n\n искомый элемент: a[" << mr << "][" << mc << "] = " << a[mr][mc] << endl;
return 0;
}
устройство ввода ето правильно понял