??? ?????? ??????
????????????? ???? ??????? ???? ?????? ????????? ???????? ? ?????????? ?????????. ? Turbo Pascal ????? ?????????????? ????? ???????, ?????????? ????????? ?????????? ?????????. ?????? - ??? ?????????? ??????????? ?????????? ?????????? ????????, ??????????????? ??? ???? ?????. ? ????????????? ????????????? ??????? ?? ???????? ?????? ???, ????? ????????? ??????? ? ???????????? ???????????? ? ????????? ?????, ???????????? ?? ?????????? ?????????, ??? ??????????? ???????.
??? ?????????? ?????? ??????????? ? ????????? ????????? ???????:
a : array [<??? ???????>] of <??? ?????????>;
?????: a - ??? ?????????? ???????;
array, of - ????????????????? ????? (??????, ??);
<??? ???????> - ????? ????????????? ???, ??????????? ?? ???-?? ????????? ???????;
<??? ?????????> - ??? ?????? ????????? ???????.
???????? ??? ??????? ?????????? ????????? ??????? ???????????? ???-????????. ???-???????? ???????? ????? ? ?????? ????????? ????????? ??????? ???????. ????????:
Var
a : array [1..10] of Integer;
b : array [0..50] of Real;
c : array [-3..4] of Integer;
?? ??????? ?? ?????, ??? ?????? A ??????? ?? 10 ?????????, ?????? B - ?? 51 ????????, ? ?????? C - ?? 8 ?????????.
? ????????? ?? ????? ??????? ???????????? ?????????? ??????, ???????? ????????? ?????? ? ???????? ???????. ?????? ? ???????? ??????? ?????????????? ? ??????? ??????? ??? ??????? - ?????? ?????, ????????? ???????????? ?????? ???????? ? ???????. ??? ?????????? ? ????????? ?????? ???????? ??????? ????? ?? ?????? ??????? ?????? ????????? ?????? ???????? ? ?????????? ???????: a[1], b[0], c[-3].
? ????????? ???????????? ????????? ?????? ?? ?????? ???????? ?? ???????, ???????????? ????? ????????. ??? ??? ??? ?? ???????? A, B, C ?????????? ????? ????????? a[11], b[-1], c[5].
??? ??????????? ?????? ??????? ???? ?????????? ????????? ????????.
?????? 1.
?????? ?????????????????? ?? 10 ????? ?????. ????????? ?????????? ?? ???????? ??????????????? ??? ??????? ???????? ??????????????????.
| Program p1; Var s, i : Integer; sr, a : Real; b : array [1..10] of Integer; Begin s := 0; For i := 1 to 10 do begin Read (b[ i ]); s := s + b[ i ]; end; sr := s / 10; For i := 1 to 10 do begin a := abs (sr - b[ i ]); Write (a : 5 : 1); end; End. |
?????? 2.
?????? ?????????????????? ?? 10 ????? ?????. ??????????? ?? ? ???????? ???????.
| Program p2; Var i : Integer; a : array [-3..6] of Integer; Begin For i := -3 to 6 do Read (a[ i ]); For i := 6 downto -3 do Write (a[ i ] : 4); End. |
?????? 3.
?????? ?????????????????? ?? 10 ????? ?????. ??????? ????? ???, ??????? ?????? ???????? ???????????????.
| Program p3; Var s, i : Integer; sr : Real; c : array [1..10] of Integer; Begin s := 0; For i := 1 to 10 do begin Read (c[ i ]); s := s + c[ i ]; end; sr := s / 10; For i := 1 to 10 do If c[ i ] > sr then Write (i : 4); End. |
< Предыдущая | Следующая > |
---|