Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Delphi программирование > Паскаль, Turbo Pascal, PascalABC.NET
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 16.05.2010, 20:51   #1
Олеся_92
 
Регистрация: 16.11.2009
Сообщений: 5
Восклицание Калькулятор над матрицами

Помогите исправить работу, мне нужно, чтобы выводились числа на экран, которые выбираются с помощью стрелок на клавиатуре! Если работать цыфрами, то всё в порядке, а вот если нужно вывести двузначное число, то тут проблема!

Последний раз редактировалось Олеся_92; 16.05.2010 в 20:54.
Олеся_92 вне форума Ответить с цитированием
Старый 16.05.2010, 20:53   #2
Олеся_92
 
Регистрация: 16.11.2009
Сообщений: 5
По умолчанию

program calculator;
uses graph,crt;
type mas=array[1..5,1..5] of integer;
Var gr,gm,x,y,stepx,stepy,enter,i,j,n,m :integer;
is:word;
ch,si:char;
seointer;
k:mas;
procedure Menu;
var s,s1,s2,s3:string;
begin
s:='Kalkulator (K)';
s1:='Options (O)';
s2:='Help (H)';
s3:='Exit (X)';
setbkcolor(3);
setcolor(4);
rectangle(240,100,400,150);
rectangle(240,160,400,210);
rectangle(240,220,400,270);
rectangle(240,280,400,330);
setfillstyle(1,4);
floodfill(245,105,4);
floodfill(245,165,4);
floodfill(245,225,4);
floodfill(245,285,4);
setcolor(15);
outtextxy(255,120,s);
outtextxy(255,180,s1);
outtextxy(255,240,s2);
outtextxy(255,300,s3);
end;
procedure help;
var s,s1,s2:string;
begin
s:='Operazii nad matrizami(M)';
s1:='Ob Avtore (i)';
setbkcolor(7);
setcolor(4);
rectangle(200,160,430,210);
rectangle(200,220,430,270);
setfillstyle(1,4);
floodfill(245,165,4);
floodfill(245,225,4);
setcolor(15);
outtextxy(205,180,s);
outtextxy(205,240,s1);
end;

procedure interfase;
var x:integer;
sm,sa,sl,bu,buy,bur,seointer;
begin
setbkcolor(0);
setcolor (15);
line(0,1,0,29); Line(30,1,30,29); Line(1,0,29,0); Line(1,30,29,30);
setfillstyle (1,1);
bar (1,1,29,29);
is:=imagesize(0,0,30,30);
getmem(bu,is);
getimage(0,0,30,30,bu^);
clearviewport;
setcolor (15);
line(0,1,0,29); Line(30,1,30,29); Line(1,0,29,0); Line(1,30,29,30);
setfillstyle (1,2);
bar (1,1,29,29);
is:=imagesize(0,0,30,30);
getmem(buy,is);
getimage(0,0,30,30,buy^);
clearviewport;
setcolor (15);
line(0,1,0,29); Line(30,1,30,29); Line(1,0,29,0); Line(1,30,29,30);
setfillstyle (1,4);
bar (1,1,29,29);
is:=imagesize(0,0,30,30);
getmem(bur,is);
getimage(0,0,30,30,bur^);
clearviewport;
setfillstyle (4,8);
bar (40,40,400,400);
rectangle(40,40,400,400);
putimage (70, 350,bur^,2);
putimage (140, 350,buy^,2);
putimage (210, 350,buy^,2);
putimage (280, 350,buy^,2);
putimage (350, 350,buy^,2);
putimage (70, 300,bu^,2);
putimage (140, 300,bu^,2);
putimage (210, 300,bu^,2);
putimage (280, 300,bu^,2);
putimage (350, 300,bu^,2);
putimage (70, 250,bu^,2);
putimage (140, 250,bu^,2);
putimage (210, 250,bu^,2);
putimage (280, 250,bu^,2);
putimage (350, 250,bu^,2);
settextstyle (0,0,2);
outtextxy (80,260,'1');
outtextxy (150,260,'2');
outtextxy (220,260,'3');
outtextxy (290,260,'4');
outtextxy (360,260,'5');
outtextxy (80,310,'6');
outtextxy (150,310,'7');
outtextxy (220,310,'8');
outtextxy (290,310,'9');
outtextxy (360,310,'0');
setcolor (1);
settextstyle (2,0,2);
outtextxy (75,360,'EXC');
outtextxy (155,360,'+');
outtextxy (220,360,'-');
outtextxy (290,360,'*');
outtextxy (360,360,'Tr');
setfillstyle(1,0);
setcolor(15);
bar(70,100,380,230);
rectangle(70,100,380,230);
bar(430,100,500,230);
rectangle(430,100,600,230);
outtextxy(470,110,'Upravlenie');
outtextxy(440,140,#27);
outtextxy(450,140,#25);
outtextxy(450,130,#24);
outtextxy(460,140,#26);
outtextxy(470,140,'-Peremeschenie');
outtextxy(440,160,'<ENTER>-Vibor');
outtextxy(440,180,'<ESC>-Vichod');
end;

procedure Vichod;
begin
closegraph;
Halt(1);
end;

procedure monitor (b:integer);
var s:string;i,j:integer;
begin
Str(b,s);
settextjustify(2,2);
setcolor(15);
outtextxy(90,120,s);
end;

procedure calk;
type mas=array [1..5,1..5] of integer;
var x,y,x2,y2,chisl,stepx,b,a,stepy,zn: integer;
k:mas;
seointer;
is:word;
begin
n:=2; m:=2;
stepx:=0; stepy:=150;
x:=70+stepx; y:=200+stepy;
setfillstyle(1,14);
bar(0,0,30,30);
is:=imagesize(0,0,30,30);
getmem(se,is);
getimage(0,0,30,30,se^);
clearviewport;
interfase;
putimage(x,y,se^,1);
While true do
begin
ch:=readkey;
case ch of
#27:begin CloseGraph; Halt(1); end;
#75:stepx:=stepx-70;
#72:stepy:=stepy-50;
#80:stepy:=stepy+50;
#77:stepx:=stepx+70;
#13:enter:=1;
end;
if (stepx>280) then stepx:=0;
if (stepx<0) then stepx:=280;
if (stepy>150) then stepy:=50;
if (stepy<50) then stepy:=150;
x:=70+stepx; y:=200+stepy;
putimage (x,y,se^,1);
x2:=stepx; y2:=stepy;
Олеся_92 вне форума Ответить с цитированием
Старый 16.05.2010, 20:54   #3
Олеся_92
 
Регистрация: 16.11.2009
Сообщений: 5
По умолчанию

if (enter=1) then
begin
{ for i:=1 to n do
for j:=1 to m do
begin}
if (x2=0) then
begin
case y2 of
50:begin chisl:=1; enter:=0; end;
100:begin chisl:=6; enter:=0; end;
150:vichod;
end;
a:=a*10+chisl;
b:=a;
monitor(b);
x:=70+stepx; y:=200+stepy;
putimage (x,y,se^,1);
end;
if (x2=70) then
begin
case y2 of
50:begin chisl:=2; enter:=0; end;
100:begin chisl:=7; enter:=0; end;
150:zn:=1;
end;
a:=a*10+chisl;
b:=a;
monitor(b);
x:=70+stepx; y:=200+stepy;
putimage (x,y,se^,1);
end;
if (x2=140) then
begin
case y2 of
50:begin chisl:=3; enter:=0; end;
100:begin chisl:=8; enter:=0; end;
150:zn:=2;
end;
a:=a*10+chisl;
b:=a;
monitor(b);
x:=70+stepx; y:=200+stepy;
putimage (x,y,se^,1);
end;
if (x2=210) then
begin
case y2 of
50:begin chisl:=4; enter:=0; end;
100:begin chisl:=9; enter:=0; end;
150:zn:=3;
end;
a:=a*10+chisl;
b:=a;
monitor(b);
x:=70+stepx; y:=200+stepy;
putimage (x,y,se^,1);
end;
if (x2=280) then
begin
case y2 of
50:begin chisl:=5;enter:=0; end;
100:begin chisl:=0; enter:=0; end;
150:zn:=4;
end;
a:=a*10+chisl;
b:=a;
monitor(b);
x:=70+stepx; y:=200+stepy;
putimage (x,y,se^,1);
end;
end;
end;
end;
begin
gr:=0; gm:=detect; Initgraph (gr,gm, '');
if graphresult <> grok
then
begin
writeln ('oschibka');
exit;
end
else menu;

repeat
ch:=readkey;
case ch of
'x': exit;
'h': begin
cleardevice;
help;
si:=readkey;
if si=#27 then begin
cleardevice;
menu;
end;
end;
'k': begin
cleardevice;
calk;
end;
end;
until (ch='o');
end.
Олеся_92 вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Арифметические действия над матрицами и транспонирование Axel1981 Помощь студентам 14 12.06.2010 20:20
Графический калькулятор над матрицами Олеся_92 Помощь студентам 2 04.05.2010 18:10
Универсальная функция для действия над матрицами devl Общие вопросы C/C++ 10 30.01.2010 18:49
Действия над матрицами. (Delphi) ekzobyte Помощь студентам 1 20.05.2009 20:52