Uses CRT;
Const ch1 = #201;
ch2 = #186;
ch3 = #200;
ch4 = #205;
ch5 = #188;
ch6 = #187;
del=5000;
doo=round(523.25); re=round(587.33); mi=round(659.26);
fa=round(698.46); sol=round(784.99); la=round(880.00);
si=round(987.77);
Var i,j,a,b:byte;
key:char;
Procedure Button(a,b,c:byte); {a,b - coordinates; c - colour}
Var i,j,k:byte;
Begin
j:=b;
k:=a+6;
TextColor(c);
gotoxy(a,b);
write(ch1);
for i:=1 to 4 do write(ch4);
write(ch6);
gotoxy(a,b+1);
for i:=1 to 2 do begin
write(ch2);
inc(j);
gotoxy(a,j)
end;
write(ch3);
for i:=1 to 4 do write(ch4);
write(ch5);
gotoxy(wherex-1,wherey-1);
write(ch2);
NormVideo
End;
begin
clrscr;
a:=2; b:=2;
for i:=1 to 7 do begin
Button(a,b,1);
Inc(a,10);
end;
gotoxy(3,3);
write(' До');
gotoxy(13,3);
write(' Ре');
gotoxy(23,3);
write(' Ми');
gotoxy(33,3);
write(' Фа');
gotoxy(43,3);
write('Соль');
gotoxy(53,3);
write(' Ля');
gotoxy(63,3);
write(' Си');
Repeat
if keypressed then begin
key:=readkey;
case key of
'a','A':begin
Button(2,2,2);
sound(doo);
delay(del);
nosound;
Button(2,2,1);
end;
's','S':begin
Button(12,2,2);
sound(re);
delay(del);
nosound;
Button(12,2,1);
end;
'd','D':begin
Button(22,2,2);
sound(mi);
delay(del);
nosound;
Button(22,2,1);
end;
'f','F':begin
Button(32,2,2);
sound(fa);
delay(del);
nosound;
Button(32,2,1);
end;
'j','J':begin
Button(42,2,2);
sound(sol);
delay(del);
nosound;
Button(42,2,1);
end;
'k','K':begin
Button(52,2,2);
sound(la);
delay(del);
nosound;
Button(52,2,1);
end;
'l','L':begin
Button(62,2,2);
sound(si);
delay(del);
nosound;
Button(62,2,1);
end;
end;
end;
gotoxy(20,20);
Until key=#27;
end.