www.pudn.com > c.rar > SONG.C, change:1997-01-26,size:994b


#include "dos.h" 
#define s1 5600 
#define s2 s1/2 
#define s4 s1/4 
#define s8 s1/8 
#define s16 s1/16 
enum FREQDEF 
{ 
L1=131,L2=147,L3=165,L4=175,L5=196,L6=220,L7=247,\ 
N1=262,N2=296,N3=330,N4=349,N5=392,N6=440,N7=494,\ 
H1=523,H2=587,H3=659,H4=698,H5=784,H6=880,H7=988,\ 
l1=1047,l2=1175,l3=1319,l4=1397,l5=1568,l6=1760,l7=1976 
}song[]= 
{ 
 N2,s4,N2,s8,N3,s16,N2,s16,N1,s4,L6,s4,L5,s8, 
 L3,s8,L5,s8,L6,s8,N1,s2,L6,s4,L6,s8,N1,s8, 
 N5,s8,N6,s8,N3,s8,N5,s8,N2,s1,N3,s4,N3,s8, 
 N2,s8,N3,s8,N5,s4,N3,s4,L5,s8,L3,s8,L5,s8, 
 L6,s8,N1,s2,L6,s4,L6,s8,N1,s8,L6,s8,L6,s8, 
 L2,s8,L3,s8,L5,s1,N2,s4,N2,s4,N5,s4,N6,s8, 
 N5,s8,N4,s2,N5,s2,N6,s4,N5,s8,N3,s8,N2,s8, 
 N3,s16,N2,s16,N1,s8,L6,s16,N1,s16,N2,s1,N3,s4, 
 N2,s8,N3,s8,N5,s4,N3,s4,L5,s8,L3,s8,L5,s8, 
 L6,s8,N1,s2,L6,s4,L6,s8,N1,s8,N2,s8,L6,s8, 
 N1,s8,N3,s8,N2,s1, 
 0 
}; 
void play(int freq,int dly) 
{ 
sound(freq); 
delay(dly); 
nosound(); 
} 
int main(void) 
{ 
int i; 
for(i=0;song[i];i+=2)play(song[i],song[i+1]); 
return 0; 
}