Answer the question
In order to leave comments, you need to log in
How to remove an element from an array by index?
There is
program akb;
procedure DeleteElem<T>(a: array of T; k: word);
begin
for var i := k - 1 to length(a) - 2 do
a[i] := a[i + 1];
SetLength(a, length(a) - 1);
for var i := 0 to length(a) - 1 do
write(a[i] + ' ');
end;
var
text:string;
k:integer;
begin
write ('Введите текст: ');
readln(text);
var arr := text.Split(' '); // Строка разбита на слова по пробелам
//writeln(arr[0], ' ', arr[3]); // Слово11 Слово22
write ('Введите элемент который нужно удалить: ');
readln(k);
writeln('Массив после обработки: ');
DeleteElem(arr, k);
end.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question