相关代码 |
|
/*9-2.c*/ #include main() /* music */ { int note,length; length=10; do { note=getchar( ); play(note,length); }while (note!='q'); } play(int note, int l) { int tone; l=l+1000/note; for( ;l ;l--) { tone=note; outportb(0x61,2); /* turn on speaken */ outportb(0x61,0); /* turn off speaker */ for( ;tone;--tone); } }
相关资源 |
|