level 1
zumgze
楼主
program music;
uses crt;
var i,p,k,j:integer;
m:boolean;
function mci(pszcommand:pchar) : boolean;
stdcall;
external 'winmm.dll' name 'mciExecute';
procedure mus;
begin
if p=1 then m:=mci('play E:\music\1.mp3');
if p=2 then m:=mci('play E:\music\2.mp3');
if p=3 then m:=mci('play E:\music\3.mp3');
if p=4 then m:=mci('play E:\music\4.mp3');
if p=5 then m:=mci('play E:\music\5.mp3');
if p=6 then m:=mci('play E:\music\6.mp3');
if p=7 then m:=mci('play E:\music\7.mp3');
if k=0 then begin
delay(500);
j:=j+2;
end;
if k=1 then begin
delay(250);
j:=j+1;
end;
if p=1 then m:=mci('stop E:\music\1.mp3');
if p=2 then m:=mci('stop E:\music\2.mp3');
if p=3 then m:=mci('stop E:\music\3.mp3');
if p=4 then m:=mci('stop E:\music\4.mp3');
if p=5 then m:=mci('stop E:\music\5.mp3');
if p=6 then m:=mci('stop E:\music\6.mp3');
if p=7 then m:=mci('stop E:\music\7.mp3');
end;
begin
j:=0;
write('/ ');
for i:=1 to 20 do
begin
k:=random(2);
if j mod 4 =3 then k:=1;
p:=random(8);
mus;
if k=1 then write(p);
if k=0 then write(p,' ','-');
write(' ');
if j mod 4=0 then write ('/ ');
end;
readln;
end.
2015年08月23日 06点08分
1
uses crt;
var i,p,k,j:integer;
m:boolean;
function mci(pszcommand:pchar) : boolean;
stdcall;
external 'winmm.dll' name 'mciExecute';
procedure mus;
begin
if p=1 then m:=mci('play E:\music\1.mp3');
if p=2 then m:=mci('play E:\music\2.mp3');
if p=3 then m:=mci('play E:\music\3.mp3');
if p=4 then m:=mci('play E:\music\4.mp3');
if p=5 then m:=mci('play E:\music\5.mp3');
if p=6 then m:=mci('play E:\music\6.mp3');
if p=7 then m:=mci('play E:\music\7.mp3');
if k=0 then begin
delay(500);
j:=j+2;
end;
if k=1 then begin
delay(250);
j:=j+1;
end;
if p=1 then m:=mci('stop E:\music\1.mp3');
if p=2 then m:=mci('stop E:\music\2.mp3');
if p=3 then m:=mci('stop E:\music\3.mp3');
if p=4 then m:=mci('stop E:\music\4.mp3');
if p=5 then m:=mci('stop E:\music\5.mp3');
if p=6 then m:=mci('stop E:\music\6.mp3');
if p=7 then m:=mci('stop E:\music\7.mp3');
end;
begin
j:=0;
write('/ ');
for i:=1 to 20 do
begin
k:=random(2);
if j mod 4 =3 then k:=1;
p:=random(8);
mus;
if k=1 then write(p);
if k=0 then write(p,' ','-');
write(' ');
if j mod 4=0 then write ('/ ');
end;
readln;
end.