uses Graph,crt; const dist = 3; procedure show_menu(current: integer; const menu_str: array of string; const size: integer); Var i, px, color: integer; Begin px := dist; setcolor(white); settextjustify(centertext, centertext); for i := 0 to pred(size) do begin if (current - 1) = i then color := blue else color := green; setfillstyle(solidfill, color); bar(px, dist, px + textwidth(menu_str[i]) + 2 * dist, dist + textheight(menu_str[i]) + 2 * dist); rectangle(px, dist, px + textwidth(menu_str[i]) + 2 * dist, dist + textheight(menu_str[i]) + 2 * dist); outtextxy(px + (textwidth(menu_str[i]) + 2 * dist) div 2, dist + (textheight(menu_str[i]) + 2 * dist) div 2, menu_str[i]); inc(px, textwidth(menu_str[i]) + 3 * dist) end; end; function get_menu(start: integer; const menu_str: array of string; const size: integer): integer; var _stop: boolean; begin _stop := false; repeat show_menu(start, menu_str, size); case readkey of #0: case readkey of #75: { left } if start > 1 then dec(start); #77: { right } if start < size then inc(start); end; #13: { enter } _stop := true; end; until _stop; get_menu := start; end; const n = 3; arr: array[1 .. n] of string = ( 'zadacha 1', 'zadacha 2', 'exit' ); var select: integer; g_driver, g_mode, err_code: integer; t:array [1..20] of real; j:integer; s,d:real; begin g_driver := Detect; initgraph(g_driver, g_mode, ''); err_code := graphresult; if err_code <> grOk then begin writeln('Graphics error: ', grapherrormsg(err_code)); readln; halt(100); end; select := 1; repeat select := get_menu(select, arr, n); case select of 1:begin for j:=1 to 20 do begin textcolor(3);gotoxy(20,1);write('vvedite 20 elementov massiva'); textcolor(2);gotoxy(5,2+j);write(j,' element massiva; '); gotoxy(25,2+j);read(t[j]); end; s:=0; for j:=1 to 20 do s:=s+t[j]; d:=S/20; for j:=1 to 20 do begin if t[j]<0 then t[j]:=d else t[j]:=t[j]*3; textcolor(4);gotoxy(37,2+j);write(j,' izmenen ', t[j]:5:2); end; readkey; end; 2: outtextxy(120, 120, 'world'); end; until select = 3; closegraph; end.