A:
var
s: string;
i: integer;
begin
Write('Введите строку: ');
ReadLn(s);
for i := 1 to length(s) do
if s[i] = '.' then s[i] := '0' else
if (s[i] = 'x') or (s[i] = 'X') then s[i] := '1' else
s := 'Ошибка формата';
break;
end;
WriteLn('Двоичный код: ', s);
end.
B:
if s[i] = '0' then s[i] := '1' else if s[i] = '1' then s[i] := '0';
WriteLn('Инверсия: ', s);
Объяснение:
#include <iostream>
using namespace std;
int main()
{
int n, m;
int **arr;
int min;
cout << "Enter dimension of array (n/m)" << endl;
cin >> n >> m;
arr = new int *[n];
for (int i = 0; i < n; i++) {
arr[i] = new int[m];
}
for (int j = 0; j < m; j++) {
cout << "arr[" << i << "][" << j << "] = ";
cin >> arr[i][j];
cout << "Your array:" << endl;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
cout << arr[i][j] << " ";
cout << endl;
cout << "Min is: ";
min = arr[0][0];
if (min > arr[i][j]) {
min = arr[i][j];
cout << min << endl;
return 0;
A:
var
s: string;
i: integer;
begin
Write('Введите строку: ');
ReadLn(s);
for i := 1 to length(s) do
begin
if s[i] = '.' then s[i] := '0' else
if (s[i] = 'x') or (s[i] = 'X') then s[i] := '1' else
begin
s := 'Ошибка формата';
break;
end;
end;
WriteLn('Двоичный код: ', s);
end.
B:
var
s: string;
i: integer;
begin
Write('Введите строку: ');
ReadLn(s);
for i := 1 to length(s) do
if s[i] = '0' then s[i] := '1' else if s[i] = '1' then s[i] := '0';
WriteLn('Инверсия: ', s);
end.
Объяснение:
#include <iostream>
using namespace std;
int main()
{
int n, m;
int **arr;
int min;
cout << "Enter dimension of array (n/m)" << endl;
cin >> n >> m;
arr = new int *[n];
for (int i = 0; i < n; i++) {
arr[i] = new int[m];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cout << "arr[" << i << "][" << j << "] = ";
cin >> arr[i][j];
}
}
cout << "Your array:" << endl;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cout << arr[i][j] << " ";
}
cout << endl;
}
cout << "Min is: ";
min = arr[0][0];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (min > arr[i][j]) {
min = arr[i][j];
}
}
}
cout << min << endl;
return 0;
}