Новичок
Джуниор
Регистрация: 13.06.2015
Сообщений: 5
|
Блок-схема!
Пожалуйста, кто сможет, нарисуйте блок - схему по коду!
Заранее спасибо!
Код:
Код:
uses Crt,Keyboard,Dos;
const
num_notes=12;
M:array[1..num_notes] of integer = (262,277,294,311,330,349,370,392,415,440,466,494);
ke2:array [1..num_notes] of byte=(kQ,k2,kW,k3,kE,kR,k5,kT,k6,kY,k7,kU);
keys:string='q2w3er5t6y7uzsxdcvgbhnjm,';
Nums:array[1..num_notes] of integer=(1,1,2,2,3,4,4,5,5,6,6,7);
var
Ch: char;
status:boolean;
t,i,n,n1,Huynya: word;
KBD: KeyboardObj;
procedure Hide_Cursor;
var Regs : Registers;
begin
with Regs do
begin
Ah:=1;
Ch:=$20;
Cl:=0;
Bh:=0;
Intr($10,Regs);
end;
end;
procedure DrawKey(n:word; hold:boolean);
var
x,y,i:integer;
t:(BlackKey,WhiteKey,ErrorKey);
begin
t:=ErrorKey;
if n <= num_notes then t:=BlackKey;
if n in [1,3,5,6,8,10,12] then t:=WhiteKey;
n:=Nums[n];
case t of
BlackKey:begin
TextColor(DarkGray);
if hold then
TextColor(Red);
x:=n*4;
for y:=1 to 3 do begin
GoToXY(x-1,y);
write('ЫЫЫ');
end;
end;
WhiteKey:begin
TextColor(White);
if Hold then
TextColor(LightRed);
x:=n*4;
for y:=1 to 5 do begin
GoToXY(x-2,y);
write('Ы');
end;
i:=4;
if n in [3,7,10] then i:=1;
for y:=i to 5 do begin
GoToXY(x-1,y);
write('Ы');
end;
i:=4;
if n in [1,4,8,11] then i:=1;
for y:=i to 5 do begin
GoToXY(x-3,y);
write('Ы');
end;
i:=4;
if n in [3,7,10] then i:=1;
for y:=i to 5 do begin
GoToXY(x,y);
write('Э');
end;
end;
end;
TextColor(LightGray);
GoToXY(1,1);
end;
procedure pianino;
begin
Hide_Cursor;
TextBackground(Black);
Writeln('€¤св §*Јаг§Є* н«ҐЄва®®аЈ***... ќв® *Ґ ¬®¦Ґв §**пвм *ҐбЄ®«мЄ® ¬Ё*гв... Ђ Ґб«Ё §*©¬св, в® §**зЁв, Їа®Ј* Ї®ўЁб«*',
' (Ё«Ё Є®¬Ї ¬Ґ¤«Ґ**л© :) )...');
Delay(500);
ClrScr;
KBD.Init;
for n:=1 to num_notes do
DrawKey(n,False);
for n:=1 to num_notes do begin
if n in [1,3,5,6,8,10,12] then
GoToXY(Nums[n]*4-2,7)
else
GoToXY(Nums[n]*4,6);
write(keys[n]);
end;
repeat
n1:=n;
n:=0;
for i:=1 to num_notes do
if KBD.Down(ke2[i]) and (n=0) then
n:=i
else if n1=i then begin
NoSound;
DrawKey(i,False);
end;
if n<>0 then begin
if n1=0 then
DrawKey(n1,False);
Sound(M[n]);
DrawKey(n,True);
end
else
n:=n1;
Delay(10);
until KBD.Down(kEsc);
NoSound;
TextColor(LightGray);
ClrScr;
end;
procedure instruction;
var instr:text;
s:string;
begin
ClrScr;
writeln('Simulator pianino. Instrukciya')
writeln;
writeln('Nota `do` = klavisha `q`');
writeln('Nota `do diez` = klavisha `2`');
writeln('Nota `re` = klavisha `w`');
writeln('Nota `re diez` = klavisha `2`');
writeln('Nota `mi` = klavisha `e`');
writeln('Nota `fa` = klavisha `r`');
writeln('Nota `fa diez` = klavisha `5`');
writeln('Nota `lya` = klavisha `t`');
writeln('Nota `lya diez` = klavisha `6`');
writeln('Nota `si` = klavisha `y`');
writeln('Nota `si diez` = klavisha `7`');
writeln('Nota `sol` = klavisha `u`');
readkey;
end;
procedure firstStart;
begin
while (not status) do begin
writeln('Select');
writeln('1)Play');
writeln('2)Instruction');
writeln('3)Exit');
case readkey of
#49:begin
status:=true;
pianino;
end;
#50:begin
status:=true;
instruction;
end;
#51:exit;
end;
ClrScr;
end;
end;
begin
firstStart;
end.
Последний раз редактировалось Аватар; 15.06.2015 в 06:45.
|