高分悬赏,寻求编写简单播放器的方法,所用知识:C语言,汇编
来源:百度知道 编辑:UC知道 时间:2024/05/22 08:48:03
朋友,你可以弄个VC的代码吗,最好加点注释,如果能帮助小弟通过这次活动,小弟一定再给你追加100分,谢谢啦!
在TC 和WIN-TC 下通过,能正常工作,
你如要放不同的音乐,就编辑文件score.txt
#include<stdlib.h>
#include<stdio.h>
#include<dos.h>
void main()
{
FILE *fp;
int rate;
char sound_high[3];
float sound_long;
register int i = 0,j;
int sign = 0;
float str[100][2];
if((fp = fopen("score.txt","r")) == NULL)/*文件打开失败*/
{
printf("Open file music doc Errors!\n");
exit(1);
}
fscanf(fp,"%d",&rate);/*读取音长基数的值*/
while(!feof(fp) && !sign)/*文件没有结束并且数据还是乐谱*/
{
fscanf(fp,"%s%f",sound_high,&sound_long);/*得到音频、音长的数值*/
str[i][1] = rate*sound_long;/*音长=音长基数×节拍数*/
switch(sound_high[0])
{
case '*':/*最高音*/
{
switch(sound_high[1])/*确定发声的频率*/
{
case