Created
November 21, 2012 15:03
-
-
Save vertrigo/4125288 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Program ex5; | |
| uses crt; | |
| const n = 4; | |
| type matr = array[1..n,1..n] of real; | |
| var w:matr; | |
| procedure obr(var a:matr; n:integer); | |
| var i,j:integer; | |
| begin | |
| for i:=1 to n do | |
| for j:=1 to n do begin | |
| if (i < j) then a[i,j]:=sqr(i)+j; | |
| if (i = j) then a[i,j]:=0.5; | |
| if (i > j) then a[i,j]:=i+sqr(j); | |
| end; | |
| end; | |
| procedure vivod(a:matr; m_name:char; n:integer); | |
| var i,j:integer; | |
| begin | |
| writeln('Исходная матрица ',m_name,':'); | |
| for i:=1 to n do begin | |
| for j:=1 to n do write(a[i,j]:5:1); | |
| writeln; | |
| writeln; | |
| end; | |
| end; | |
| procedure result(a:matr; n:integer); | |
| var min,max:real; i,j,minj,maxj,mini,maxi:integer; | |
| begin | |
| max:=-maxint; min:=maxint; | |
| for i:=1 to n do begin | |
| for j:=1 to n do begin | |
| if (a[i,j] <= min) then begin | |
| min:=a[i,j]; | |
| mini:=i; | |
| minj:=j; | |
| end; | |
| if (a[i,j] >= max) then begin | |
| max:=a[i,j]; | |
| maxi:=i; | |
| maxj:=j; | |
| end; | |
| end; | |
| end; | |
| writeln('Минимальный элемент находится на пересечении следующей строки:'); | |
| for j:=1 to n do begin | |
| write(a[mini,j]:5:1); | |
| end; | |
| writeln; | |
| writeln('и столбца матрицы:'); | |
| writeln; | |
| for i:=1 to n do begin | |
| writeln(a[i,minj]:5:1); | |
| writeln; | |
| end; | |
| writeln('Максимальный элемент находится на пересечении следующей строки:'); | |
| for j:=1 to n do begin | |
| write(a[maxi,j]:5:1); | |
| end; | |
| writeln; | |
| writeln('и столбца матрицы:'); | |
| writeln; | |
| for i:=1 to n do begin | |
| writeln(a[i,maxj]:5:1); | |
| writeln; | |
| end; | |
| end; | |
| Begin | |
| clrscr; | |
| obr(w,n); | |
| vivod(w,'W',n); | |
| writeln('Нажмите любую клавишу для продолжения...'); | |
| readkey; | |
| result(w,n); | |
| readkey; | |
| End. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Program ex6; | |
| uses crt; | |
| const full = ['a'..'z']; | |
| type alphabet = 'a'..'z'; | |
| str = set of alphabet; | |
| var st:str; i,count:integer; c:string; | |
| begin | |
| clrscr; | |
| st:=[]; | |
| count:=1; | |
| writeln('Введите последовательность слов английскими буквами'); | |
| writeln('Ввод закончится, когда будут задействованы все буквы алфавита'); | |
| repeat | |
| readln(c); | |
| for i:=1 to length(c) do begin | |
| st:=st+[c[i]]; | |
| if (c[i]=chr(32)) then count:=count+1; | |
| end; | |
| until st = full; | |
| writeln('Задействованы все буквы английского алфавита'); | |
| writeln('Понадобилось ',count,' слов, чтобы задействовать все буквы алфавита'); | |
| Readkey; | |
| end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment