MODULE ADruS183; IMPORT Log := StdLog, In := i21sysIn, Math; PROCEDURE Делать*; CONST M = 100; N = 10; TYPE String = ARRAY M OF CHAR; VAR T: ARRAY N OF String; x: String; VAR i, L, R, m: INTEGER; BEGIN (*ввод аргумента поиска и таблицы: *) In.Open; ASSERT( In.done ); In.String( x ); ASSERT( In.done ); FOR i := 0 TO N-1 DO In.String( T[i] ); ASSERT( In.done ) END; (******************************************) L := 0; R := N; WHILE L < R DO m := (L+R) DIV 2; i := 0; WHILE ( x[i] # 0X ) & ( T[m, i] = x[i] ) DO i := i+1 END; IF T[m, i] < x[i] THEN L := m+1 ELSE R := m END END; IF R < N THEN i := 0; WHILE ( x[i] # 0X ) & ( T[R, i] = x[i] ) DO i := i+1 END END; (* ( R < N ) & ( T[R,i] = x[i] ) устанавливает совпадение *) (****************************************************) Log.Int( R ); Log.Tab; Log.String( T[R] ); Log.Ln; END Делать; END ADruS183.