主题:please come in!!!
我在遍一个音乐程序,运行出现了:Division by zero,但我程序中并没有0作除数啊
这个是单元
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 musicprogram (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(octave,note,duration);
end;
close(songfile);
end.
请教一下
这个是单元
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 musicprogram (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(octave,note,duration);
end;
close(songfile);
end.
请教一下