Steven_MengのBlog

hhh不解释

不知道是哪位神人做的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
/*演奏乐曲《小星星》《茉莉花》《找朋友》《上学歌》《一分钱》《征服》《沧海一声笑》《童话》《同桌的你》《小熊和洋娃娃》*/
#include<stdio.h>
#include<windows.h>
void _wo_men_duo_me_xing_fu(void);
void _long_de_chuan_ren(void);
void play_zhaopengyou(void);
void play_shangxuege(void);
void play_yifenqian(void);
void play_zhengfu(void);
void play_canghaiyishengxiao(void);
void play_tonghua(void);
void play_tongzhuodeni(void);
void play_xiaoxiongheyangwawa(void);
int main()
{
int choice;
while(1)
{
printf("请选择:");scanf("%d",&choice);
switch(choice)
{
case 1: _wo_men_duo_me_xing_fu(); break;
case 2: _long_de_chuan_ren();break;
case 3: play_zhaopengyou();break;
case 4: play_shangxuege();break;
case 5: play_yifenqian();break;
case 6: play_zhengfu();break;
case 7: play_canghaiyishengxiao();break;
case 8: play_tonghua();break;
case 9: play_tongzhuodeni();break;
case 10: play_xiaoxiongheyangwawa();break;
case 0: break;
default: printf("输入有误!请正确输入!\n");
}
Beep(0,1000);//暂停一秒钟
printf("\n");
if(choice==0)
{
printf("\n谢谢使用,再见!");
Beep(0,1000);//暂停一秒钟
break;
}
}
return 0;
}

/*返回数字简谱中数字t所对应的频率*/
int notation_frequency(int t)
{
switch (t)
{
/*中音部分:1,2,3,4,5,6,7*/
case 1:return 523;
case 2:return 587;
case 3:return 659;
case 4:return 698;
case 5:return 784;
case 6:return 880;
case 7:return 988;
/*低音部分:-1,-2,-3,-4,-5,-6,-7*/
case -1:return 262;
case -2:return 294;
case -3:return 330;
case -4:return 349;
case -5:return 392;
case -6:return 440;
case -7:return 494;
/*高音部分:11,12,13,14,15,16,17*/
case 8:return 1047;
case 9:return 1175;
case 10:return 1319;
case 11:return 1397;
case 12:return 1568;
case 13:return 1760;
case 14:return 1976;
/*安静:0,不合法数值*/
default:return 0;
}
}


void _wo_men_duo_me_xing_fu(void)
{
int i;
int _xiaoxingxing[]={};
int notation_frequency(int t);
Beep(0,1000);
for (i=0;i<=47;i++)
{
if(_xiaoxingxing[i]==0) printf("\n"); else printf("%d",_xiaoxingxing[i]);
Beep(notation_frequency(_xiaoxingxing[i]),1000);
}
printf("thanks \n");
}

void _long_de_chuan_ren(void)
{
int i,t;
int _molihua[]={};
Beep(0,1000);
for (i=0;i<=71;i++)
{
t=_molihua[i];
if(t<0) t=-t;
t=t%10;
if(t==0) printf("\n"); else printf("%d",t);
Beep(notation_frequency(_molihua[i]),1000);
}
printf("thanks \n");
}

void play_zhaopengyou(void)
{
int i,t;
int _zhaopengyou[32]={5,6,5,6,5,6,5,0,
5,11,7,6,5,5,3,0,
5,5,3,3,5,5,3,0,
2,4,3,2,1,2,1,0,
};//找朋友乐谱
int notation_frequency(int t);
printf("请欣赏乐曲《找朋友》……\n");
Beep(0,1000);//暂停一秒钟
for (i=0;i<=31;i++)
{
t=_zhaopengyou[i];
if(t<0) t=-t;
t=t%10;
if(t==0) printf("\n"); else printf("%d",t);
Beep(notation_frequency(_zhaopengyou[i]),1000);
}
printf("演奏完毕!谢谢欣赏!\n");
}

/*演奏《上学歌》*/
void play_shangxuege(void)
{
int i,t;
int _shangxuege[30]={1,2,3,1,5,0,
6,6,11,6,5,0,
6,6,11,0,
5,6,3,0,
6,5,3,5,3,1,2,3,1,0
};//找朋友乐谱
int notation_frequency(int t);
printf("请欣赏乐曲《上学歌》……\n");
Beep(0,1000);//暂停一秒钟
for (i=0;i<=29;i++)
{
t=_shangxuege[i];
if(t<0) t=-t;
t=t%10;
if(t==0) printf("\n"); else printf("%d",t);
Beep(notation_frequency(_shangxuege[i]),1000);
}
printf("演奏完毕!谢谢欣赏!\n");
}

/*演奏《一分钱》*/
void play_yifenqian(void)
{
int i,t;
int _yifenqian[52]={5,11,6,11,5,0,
3,5,2,3,5,0,
3,5,6,11,5,6,5,3,5,1,0,
3,2,0,
3,2,1,2,3, 0,
6,5,3,5,6,0,
5,11,11,6,5,6,3,0,
5,2,3,2,1,0
};//找朋友乐谱
int notation_frequency(int t);
printf("请欣赏乐曲《一分钱》……\n");
Beep(0,1000);//暂停一秒钟
for (i=0;i<=51;i++)
{
t=_yifenqian[i];
if(t<0) t=-t;
t=t%10;
if(t==0) printf("\n"); else printf("%d",t);
Beep(notation_frequency(_yifenqian[i]),1000);
}
printf("演奏完毕!谢谢欣赏!\n");
}

/*演奏《征服》*/
void play_zhengfu(void)
{
int i,t;
int _zhengfu[33]={5,11,7,5,5,6,5,0,
5,11,7,5,6,3,6,0,
6,6,6,5,3,3,4,0,
4,4,4,5,6,3,2,2,0,
};//征服乐谱
int notation_frequency(int t);
printf("请欣赏乐曲《征服》……\n");
Beep(0,1000);//暂停一秒钟
for (i=0;i<=32;i++)
{
t=_zhengfu[i];
if(t<0) t=-t;
t=t%10;
if(t==0) printf("\n"); else printf("%d",t);
Beep(notation_frequency(_zhengfu[i]),1000);
}
printf("演奏完毕!谢谢欣赏!\n");
}

/*演奏《沧海一声笑》*/
void play_canghaiyishengxiao(void)
{
int i,t;
int _canghaiyishengxiao[31]={12,12,1,6,5,4,0,
6,5,4,2,1,0,
1,2,1,2,4,4,5,6,11,0,
12,12,11,6,5,4,5,0
};//沧海一声笑乐谱
int notation_frequency(int t);
printf("请欣赏乐曲《沧海一声笑》……\n");
Beep(0,1000);//暂停一秒钟
for (i=0;i<=30;i++)
{
t=_canghaiyishengxiao[i];
if(t<0) t=-t;
t=t%10;
if(t==0) printf("\n"); else printf("%d",t);
Beep(notation_frequency(_canghaiyishengxiao[i]),1000);
}
printf("演奏完毕!谢谢欣赏!\n");
}
/*演奏《童话》*/
void play_tonghua(void)
{
int i,t;
int _tonghua[46]={5,4,3,0,
3,4,3,0,
3,4,3,4,3,2,1,0,
1,3,5,6,0,
6,6,5,2,2,4,3,0,
1,3,5,6,0,
6,6,7,6,5,4,3,4,3,2,1,0,
};//童话乐谱
int notation_frequency(int t);
printf("请欣赏乐曲《童话》……\n");
Beep(0,1000);//暂停一秒钟
for (i=0;i<=45;i++)
{
t=_tonghua[i];
if(t<0) t=-t;
t=t%10;
if(t==0) printf("\n"); else printf("%d",t);
Beep(notation_frequency(_tonghua[i]),1000);
}
printf("演奏完毕!谢谢欣赏!\n");
}
/*演奏《同桌的你》*/
void play_tongzhuodeni(void)
{
int i,t;
int _tongzhuodeni[71]={5,5,5,5,3,4,5,7,0,
6,6,6,6,4,6,5,0,
5,5,5,5,7,6,5,4,0,
4,4,4,4,3,2,1,0,
11,11,11,11,5,6,11,11,11,11,0,
12,12,12,12,11,7,6,0,
7,7,7,7,7,11,12,0,
5,0,
7,7,11,12,11,7,11,0,
};//同桌的你乐谱
int notation_frequency(int t);
printf("请欣赏乐曲《同桌的你》……\n");
Beep(0,1000);//暂停一秒钟
for (i=0;i<=70;i++)
{
t=_tongzhuodeni[i];
if(t<0) t=-t;
t=t%10;
if(t==0) printf("\n"); else printf("%d",t);
Beep(notation_frequency(_tongzhuodeni[i]),1000);
}
printf("演奏完毕!谢谢欣赏!\n");
}
/*演奏《小熊和洋娃娃》*/
void play_xiaoxiongheyangwawa(void)
{
int i,t;
int _xiaoxiongheyangwawa[77]={1,0,
2,3,4,5,5,5,4,3,4,4,4,3,2,1,3,5,1,0,
2,3,4,5,5,5,4,3,4,4,4,3,2,1,3,1,6,0,
6,6,5,4,5,5,5,4,3,4,4,4,3,2,1,3,5,6,0,
6,6,5,4,5,5,5,4,3,4,0,
4,4,3,2,1,0,
3,1,0,
};//小熊和洋娃娃乐谱
int notation_frequency(int t);
printf("请欣赏乐曲《小熊和洋娃娃》……\n");
Beep(0,1000);//暂停一秒钟
for (i=0;i<=76;i++)
{
t=_xiaoxiongheyangwawa[i];
if(t<0) t=-t;
t=t%10;
if(t==0) printf("\n"); else printf("%d",t);
Beep(notation_frequency(_xiaoxiongheyangwawa[i]),1000);
}
printf("演奏完毕!谢谢欣赏!\n");
}

 评论