program calc; uses crt; procedure command_string; begin CLrScr; TextColor(3); gotoxy(7,1); Writeln('浜様様様様様様様様様様様様様様 '); gotoxy(7,2); writeln(' 讓祀閧 '); gotoxy(7,3); writeln('藩様様様様様様様様様様様様様様 '); gotoxy(7,4); writeln(' '); gotoxy(7,5); writeln('藩様様様様様様様様様様様様様様 '); end; procedure buttoms(srav:integer); procedure buttom(col,x1,y1,x2,y2,x3,y3,n1,n2:byte;name:string); begin TextColor(col); gotoxy(x1,y1); writeln('浜様'); gotoxy(x2,y2); writeln(' '); gotoxy(x3,y3); writeln('藩様'); gotoxy(n1,n2); write(name); end; procedure Especial_buttom(col,x1,y1,x2,y2,x3,y3,n1,n2:byte;name:string); begin TextColor(col); gotoxy(x1,y1); writeln('浜様様様様様様様'); gotoxy(x2,y2); writeln(' '); gotoxy(x3,y3); writeln('藩様様様様様様様'); gotoxy(n1,n2); write(name); end; begin {ム覃 痰.} if srav=1 then buttom(5,7,6,7,7,7,8,9,7,'+') else buttom(1,7,6,7,7,7,8,9,7,'+'); if srav=2 then buttom(5,7,9,7,10,7,11,9,10,'-') else buttom(1,7,9,7,10,7,11,9,10,'-'); if srav=3 then buttom(5,7,12,7,13,7,14,9,13,'*') else buttom(1,7,12,7,13,7,14,9,13,'*'); if srav=4 then buttom(5,7,15,7,16,7,17,9,16,'/') else buttom(1,7,15,7,16,7,17,9,16,'/'); {皰牀 痰.} if srav=5 then buttom(5,13,6,13,7,13,8,15,7,'1') else buttom(1,13,6,13,7,13,8,15,7,'1'); if srav=6 then buttom(5,13,9,13,10,13,11,15,10,'5') else buttom(1,13,9,13,10,13,11,15,10,'5'); if srav=7 then buttom(5,13,12,13,13,13,14,15,13,'9') else buttom(1,13,12,13,13,13,14,15,13,'9'); if srav=8 then buttom(5,13,15,13,16,13,17,15,16,'^') else buttom(1,13,15,13,16,13,17,15,16,'^'); {爛皋 痰.} if srav=9 then buttom(5,19,6,19,7,19,8,21,7,'2') else buttom(1,19,6,19,7,19,8,21,7,'2'); if srav=10 then buttom(5,19,9,19,10,19,11,21,10,'6') else buttom(1,19,9,19,10,19,11,21,10,'6'); if srav=11 then buttom(5,19,12,19,13,19,14,21,13,'0') else buttom(1,19,12,19,13,19,14,21,13,'0'); {モ騾硅 痰.} if srav=12 then buttom(5,25,6,25,7,25,8,27,7,'3') else buttom(1,25,6,25,7,25,8,27,7,'3'); if srav=13 then buttom(5,25,9,25,10,25,11,27,10,'7') else buttom(1,25,9,25,10,25,11,27,10,'7'); if srav=14 then buttom(5,25,12,25,13,25,14,27,13,'=') else buttom(1,25,12,25,13,25,14,27,13,'='); {閧覃 痰.} if srav=15 then buttom(5,31,6,31,7,31,8,33,7,'4') else buttom(1,31,6,31,7,31,8,33,7,'4'); if srav=16 then buttom(5,31,9,31,10,31,11,33,10,'8') else buttom(1,31,9,31,10,31,11,33,10,'8'); if srav=17 then buttom(5,31,12,31,13,31,14,33,13,'C') else buttom(1,31,12,31,13,31,14,33,13,'C'); if srav=18 then Especial_buttom(5,19,15,19,16,19,17,23,16,'Exit') else Especial_buttom(1,19,15,19,16,19,17,23,16,'Exit'); end; procedure plus; var a,b:integer; begin a:=a+b; end; procedure minus; var a,b:integer; begin a:=a-b; end; procedure multiply; var a,b:integer; begin a:=a*b; end; procedure separate; var a,b:real; begin a:=a/b; end; var ch:char; kn,a,i:integer; const digits: array[0 .. 9] of integer = ( 11, 5, 9, 12, 15, 6, 10, 13, 16, 7 ); var count: integer; lett: char; label met; begin CLrScr; met:command_string; kn:=1; buttoms(kn); count := 0; while true do begin ch := #1; while (ch <> #13) and (ch <> #0) do ch := readkey; if ch = #0 then ch := readkey; case ch of #72: kn:=kn-1; #80: kn:=kn+1; #75: kn:=kn-1; #77: kn:=kn+1; #13: begin case kn of 1: begin plus; textcolor(red); lett := '+'; end; 2: begin minus; textcolor(red); lett := '-'; end; 3: begin multiply; textcolor(red); lett := '*'; end; 4: begin separate; textcolor(red); lett := '/'; end; 5, 6, 7, 9, 10, 11, 12, 13, 15, 16: begin for i := 0 to 9 do if digits[i] = kn then a := i; textcolor(green); lett := chr(a + ord('0')); end; 18: exit; end; gotoxy(8+count,4); write(lett); inc(count); end; end; if kn=0 then kn:=18; if kn=19 then kn:=1; buttoms(kn); end; end.