求助!
pascal吧
全部回复
仅看楼主
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
level 1
zumgze 楼主
为什么每次运行结果都是一样的,求助啊
2015年08月23日 06点08分 2
level 7
randomize;
2015年08月23日 08点08分 3
谢,randomize好像在修改程序的时候不小心删掉了
2015年08月23日 10点08分
level 9
干嘛不用case= =if那几句。还有随机数要初始化的0.0
2015年08月23日 10点08分 5
谢,用if是个人习惯~
2015年08月23日 10点08分
1