// PascalABC.Net 3.0, сборка 1064 const n = 10; var ms: array[1..n] of string; t: string; i, j: integer; f: Text; begin { Чтение матрицы из файла } Assign(f, 'in.txt'); Reset(f); for i := 1 to n do Readln(f, ms[i]); Close(f); { Вывод матрицы на экран } Writeln('*** Бинарная матрица ***'); for i := 1 to n do Writeln(ms[i]); { Сортировка обменом (простейшая) } for i := 1 to n - 1 do for j := 1 to n - 1 do if ms[j] > ms[j + 1] then begin t := ms[j]; ms[j] := ms[j + 1]; ms[j + 1] := t end; { Поиск одинаковых строк } Writeln('Совпадающие строки'); j := 1; t := ms[1]; for i := 2 to n do begin if ms[i] = t then Inc(j) else begin if j > 1 then begin Writeln(t); j := 1 end; t := ms[i] end end; if j > 1 then Writeln(t) end.
Sub Ex() Dim Y() As Integer, X() As Integer Dim i As Integer, n As Integer Range(Cells(1, 2), Cells(100, 2)).ClearContents i = 1 Do While Len(Cells(i, 1).Value) <> 0 i = i + 1 Loop n = i - 1 ReDim Y(1 To n), X(1 To n) For i = 1 To n Y(i) = Cells(i, 1).Value X(i) = Y(i) + i Cells(i, 2).Value = X(i) Next i End Sub
Предполагается, что данные располагаются в колонке А, начиная с ячейки А1 В колонку B будет выведен результирующий массив. Признак конца считывания - пустая ячейка в колонке А