
Ввод минимум 5 фамилий и сортировка их по алфавиту pascal


Ответы на вопрос

// PascalABC.NET 3.4.2, сборка 1782 от 01.09.2018
// Внимание! Если программа не работает, обновите версию!
begin
ReadlnString('Вводите фамилии через пробел:').ToWords.Order.Println
end.



Sorting surnames alphabetically in Pascal
To sort a list of surnames alphabetically in Pascal, you can use the built-in sorting functions or implement your own sorting algorithm. Here's an example of how you can do it using the built-in `Sort` function:
```pascal program SortSurnames;
var surnames: array[1..5] of string = ('Smith', 'Johnson', 'Williams', 'Brown', 'Jones'); i: integer;
begin // Sort the surnames alphabetically Sort(surnames);
// Display the sorted surnames for i := 1 to 5 do writeln(surnames[i]); end. ```
In this example, we have an array `surnames` containing five surnames. We use the `Sort` function to sort the surnames in alphabetical order. Finally, we iterate over the sorted array and display the surnames.
The output of this program will be:
``` Brown Johnson Jones Smith Williams ```
Please note that in this example, the surnames are hardcoded in the program. If you want to input the surnames dynamically, you can modify the program accordingly.
Note: The code provided above is a simplified example for demonstration purposes. In a real-world scenario, you would typically read the surnames from a file or user input.


Топ вопросов за вчера в категории Информатика







Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili