主题:高手们救救我
高手们救救我,帮我找找哪里错了
单元
unit music;
interface
uses crt;
procedure play (octave,note,duration:integer);
implementation
procedure play;
const base=32.625;
var x:real; i:integer;
begin
if note = 0 then delay(duration)
else
begin
x:=base;
for i:= 1 to octave do
x:=x* 2;
for i:=1 to note-1 do
x:=x *1.059463994;
sound(round(x));
delay(duration);
nosound;
end;
end;
end.
主程序:
program p11_7(songfile);
uses music;
var
songfile:text;
octave,note,duration:integer;
begin
assign(songfile,'song1.dat');
reset(songfile);
while not eof(songfile) do
begin
readln(songfile,octave,note,duration);
play(songfile,octave,note,duration);
end;
close(songfile);
end.