язык программирования любой?
пишу на Python:
s = str(input())
s = sorted(s[:len(s)-1].split(', '))
for word in s:
print(word, ' ', end='')
Pascal:
var s, copy_s, word_s:string;
i, n, count:integer;
a:array of string ;
begin
count:=0;
write('Введите перечисление слов через запятую без пробелов, в конце поставьте точку: ');
readln(s);
copy_s:= s;
while pos(',', copy_s) > 0 do begin
n:= pos(',', copy_s);
delete(copy_s, n, 1);
count:=count+1;
end;
count:= count + 1;
SetLength(a, count);
for i:=1 to count-1 do begin
n:= pos(',', s);
word_s:= copy(s, 1, n-1);
delete(s, 1, n);
a[i]:=word_s;
end;
word_s:= copy(s, 1, length(s)-1);
a[count]:= word_s;
for i:=1 to count-1 do
if a[i] > a[i+1] then begin
word_s:=a[i];
a[i]:=a[i+1];
a[i+1]:=word_s;
end;
for i:=1 to count do
writeln(a[i]);
end.
Заполняется случайными числами, можно сделать пользовательский ввод, заменив arr[i][j] = rand() % 100; на cin >> arr[i][j];
#include <iostream>
#include <random>
#include <ctime>
#include <cmath>
using namespace std;
void printArr(int** arr, size_t sizeX, size_t sizeY) {
for (size_t i = 0; i < sizeX; ++i) {
for (size_t j = 0; j < sizeY; ++j) {
cout << arr[i][j] << " ";
}
cout << endl;
}
}
void func1(int** arr, size_t sizeX, size_t sizeY) {
for (size_t i = 0; i < sizeX; ++i) {
for (size_t j = 0; j < sizeY; ++j) {
if (arr[i][j] % 2 == 1) {
arr[i][j] *= 2;
}
}
}
}
void func2(int** arr, size_t sizeX, size_t sizeY) {
for (size_t i = 0; i < sizeX; ++i) {
int32_t min = INT32_MAX;
for (size_t j = 0; j < sizeY; ++j) {
if (arr[i][j] < min) {
min = arr[i][j];
}
}
cout << i << ": sqrt(" << min << ") = " << sqrt(min) << endl;
}
}
int main() {
srand(time(0));
const size_t sizeX = 4, sizeY = 3;
int** arr = new int*[4];
for (size_t i = 0; i < sizeX; ++i) {
arr[i] = new int[sizeY];
for (size_t j = 0; j < sizeY; ++j) {
arr[i][j] = rand() % 100;
}
}
printArr(arr, sizeX, sizeY);
func1(arr, sizeX, sizeY);
cout << endl;
printArr(arr, sizeX, sizeY);
func2(arr, sizeX, sizeY);
}
1. Файлы передаются пакетами.
2. При передачи данных на каждом из серверах выполняется функция маршрутизации.