标题:[讨论]请高手来看看,没人会?
只看楼主
yk87458410
Rank: 1
等 级:新手上路
帖 子:65
专家分:0
注 册:2005-9-26
得分:0 

这首渴望的曲谱到是没有错了。不过你先要定义枚举类型。
enum NOTES
{
C10=131,D10=147,E10=165,F10=175,G10=196,A10=220,B10=247,
C0=262,D0=296,E0=330,F0=349,G0=392,A0=440,B0=494,
C1=525,D1=587,E1=659,F1=698,G1=784,A1=880,B1=988,
C2=1047,D2=1175,E2=1319,F2=1397,G2=1568,A2=1760,B2=1796
}


2005-11-19 21:23
zhai2651173
Rank: 1
等 级:新手上路
帖 子:303
专家分:0
注 册:2005-11-5
得分:0 
我就是定义了.但还不行才来问的.....我把整遍代码发你看看
/* Note:Your choice is C IDE */
#include <stdio.h>
#include<time.h>
#include<dos.h>
#define N1 64
#define N2 32
#define N4 16
#define N8 8
#define N16 4
#define END 0
enum NPTES
{
C10=131,D10=147,E10=165,F10=175,G10=196,A10=220,B10=247,
C0=262,DO=296,EO=330,FO=349,GO=392,AO=440,BO=494,
CA=525,D1=587,E1=659,F1=698,G1=784,A1=880,B1=988,
C2=1047,D2=1175,E2=1319,F2=1397,G2=1568,A2=1760,B2=1796
}
SONG[]={
D0,N4,E0,N8,D0,N8,C0,N4,A10,N4,G10,N8,E10,N8,G10,N8,G10,N8,A10,
N8,C0,N2,A10,N4,A10,N8,C0,N8,G10,N8,A0,N8,E0,N8,G0,N8,
D0,N2,EO,N4,D0,N8,E0,N8,G0,N4,E0,N4,G10,N8,E10,N8,G10,
N8,A10,N8,C0,N2,A10,N4,A10,N8,C0,N8,A10,N8,A10,N8,D10,
N8,E10,N8,G10,N2,D0,N4,DO,N4,G0,N4,A0,N8,G0,N8,F0,N2,G0,
N2,A0,N4,G0,N8,E0,N8,DO,N8,E0,D8,C0,D8,A10,N8,DO,N2,E0,
N4,G0,N8,E0,N8,G0,N4,E0,N4,G10,N8,E10,N8,G10,N8,A10,N8,
C0,N4,A10,N4,A10,N8,C0,N8,D0,N8,A10,N8,C0,N8,E0,N8,D0,
N1,END,END};
int main()
{
int note=0;
int fre,dur,control;
clock_t goal;
printf("please leason song of kewang:\n");
{
outportb(0x43,0xb6);
fre=(unsigned)(1193180L/fre);
outportb(0x42,(char)fre);
outportb(0x42,(char)(fre>>8));
control=inportb(0x61);
outportb(0x61,(control)|0x3);
}
goal=(clock_t)dur+clock();
while(goal>clock());
if(fre)
outportb(0x61,control);
goal=(clock_t)0;
note=note+2;
}
}
指教.......

日本小子有种和我单挑...................坯试日本
2005-11-19 21:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-34225-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.508977 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved