问题标题: 酷町堂:发声函数

0
1

0
已采纳
陈喆鹏
陈喆鹏
资深光能
资深光能

#include<windows.h>

Beep(a,b);

声音不连贯,编程出的音乐劣质

想发声可以这样:

char a=7;

cout<<a;

超级秘方,从不外传

0
0
黄品翔
黄品翔
初级光能
初级光能

Beep(xxx);

头文件windows

望采纳~~~

0
0
潘晨皓
潘晨皓
高级天翼
高级天翼

Beep(………………)

建议采纳楼上的

(不过酷町堂好像没有发声的题)

0
赵朗
赵朗
高级光能
高级光能

Beep(要发出的频率(HZ),发音的时长(ms)

要用<Windows.h>

0
包涵宇
包涵宇
中级天翼
中级天翼

知道

beep函数

需要#include <windows.h> 

用法:Beep(...,...);

望采纳

包涵宇在2020-03-19 14:57:09追加了内容

还有我编的:

#include<windows.h>
#include<cstdio>
#include<iostream>
#define qdo 262 
#define qre 294
#define qmi 330   
#define qfa 349
#define qso 392
#define qla 440
#define qsi 494
#define do 523
#define re 578
#define mi 659
#define fa 698
#define so 784
#define la 880
#define si 988
#define do1 1046
#define re1 1175
#define mi1 1318
#define fa1 1480
#define so1 1568
#define la1 1760
#define si1 1976
#define sqdo 277
#define sqre 311
#define sqfa 370
#define sqso 415
#define sqla 466
#define sdo 554
#define sre 622
#define sfa 740
#define sso 831
#define sla 932
#define sdo1 1046
#define sre1 1245
#define sfa1 1480
#define sso1 1661
#define sla1 1865
using namespace std;
int main()
{
	int ban=500,pai=200,dw=128,bs;
	cout<<"1.吵人音乐 2.天空之城 3.自创音乐\n"; 
	int aaa;
	cin>>aaa; 
	cout<<"请静心欣赏";
	Sleep(500);
	if(aaa==1){
		cout<<"\n\n吵人音乐"; 
		for(int i=300;i<=1000;i+=25)
			Beep(i,ban);
		for(int i=0;i<10;i++){
			Beep(1000,500);
			Beep(1010,500);
			Beep(1020,500);
			Beep(1500,500);
			Beep(1020,500);
			Beep(1010,500);
			Beep(3000,1000);
		}
		for(int i=1000;i>=300;i-=25)
			Beep(i,ban);
	}
	else if(aaa==2){
		int pai=400,ban=200;
		int ting=128;
		Sleep(1000); 
		Beep(la,ban);
		Beep(si,ban);
		Sleep(ting);
		Beep(do1,pai+ban);
		Beep(si,ban);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(mi1,pai);
		Sleep(ting); 
		Beep(si,3*pai);
		Sleep(ting);
		Beep(mi,ban);
		Beep(mi,ban); 
		Beep(la,ban+pai);
		Beep(so,ban);
		Sleep(ting);
		Beep(la,pai);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(so,2*pai);
		Sleep(ting);
		Sleep(pai);
		Beep(mi,ban);
		Sleep(ting/2);
		Beep(mi,ban);
		Sleep(ting/2);
		Beep(fa,pai+ban);
		Beep(mi,ban);
		Sleep(ting);
		Beep(fa,ban);
		Beep(do1,ban+pai);
		Sleep(ting);
		Beep(mi,2*pai);
		Sleep(ting);
		Sleep(ban);
		Beep(do1,ban);
		Sleep(ting/2);
		Beep(do1,ban);
		Sleep(ting/2);
		Beep(do1,ban);
		Sleep(ting/2);
		Beep(si,ban+pai);
		Beep(sfa,ban);
		Sleep(ting);
		Beep(sfa,pai);
		Beep(si,pai);
		Sleep(ting);
		Beep(si,2*pai);
		Sleep(ting);
		Sleep(pai);
		Beep(la,ban);
		Beep(si,ban);
		Sleep(ting); 
		Beep(do1,pai+ban);
		Beep(si,ban);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(mi1,pai);
		Sleep(ting);
		Beep(si,2*pai);
		Sleep(ting);
		Sleep(pai);
		Beep(mi,ban);
		Sleep(20);
		Beep(mi,ban);
		Sleep(ting);
		Beep(la,pai+ban);
		Beep(so,ban);
		Sleep(ting);
		Beep(la,pai);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(so,3*pai);
		Sleep(ting+ban);
		Beep(mi,ban);
		Sleep(ting/2);
		Beep(fa,pai);
		Sleep(ting);
		Beep(do1,ban);
		Beep(si,ban);
		Sleep(20);
		Beep(si,pai);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(re1,ban);
		Sleep(20);
		Beep(re1,ban);
		Sleep(20);
		Beep(mi1,ban);
		Sleep(ting/2);
		Beep(do1,pai);
		Sleep(ting+pai);
		Beep(do1,pai);
		Beep(si,ban);
		Sleep(ting);
		Beep(la,ban);
		Sleep(20);
		Beep(la,ban);
		Sleep(ting);
		Beep(si,pai);
		Sleep(ting);
		Beep(sso,pai);
		Sleep(ting);
		Beep(sso,2*pai);
		Sleep(ting+pai);
		Beep(do1,ban);
		Beep(re1,ban);
		Sleep(ting);
		Beep(mi1,pai+ban);
		Beep(re1,ban);
		Sleep(ting);
		Beep(mi1,pai);
		Sleep(ting);
		Beep(fa1,pai);
		Sleep(ting);
		Beep(re1,2*pai);
		Sleep(pai+ting);
		Beep(so,ban);
		Sleep(20);
		Beep(so,ban);
		Sleep(ting);
		Beep(do1,ban);
		Beep(si,ban);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(mi1,pai);
		Sleep(ting);
		Beep(mi1,2*pai);
		Sleep(ting+2*pai);
		Beep(la,ban);
		Beep(si,ban);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(si,pai);
		Sleep(ting);
		Beep(re1,ban);
		Sleep(20);
		Beep(re1,ban);
		Sleep(ting);
		Beep(do1,pai+ban);
		Beep(so,ban);
		Sleep(20);
		Beep(so,pai);
		Sleep(pai+ting);
		Beep(fa1,pai);
		Sleep(ting);
		Beep(mi1,pai);
		Sleep(ting);
		Beep(re1,pai);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(mi1,4*pai);
		Beep(mi1,pai*2);
		Sleep(pai+ting);
		Beep(mi1,pai);
		Sleep(ting);
		Beep(la1,2*pai);
		Sleep(ting);
		Beep(so1,pai);
		Sleep(ting);
		Beep(so1,pai);
		Sleep(ting);
		Beep(mi1,ban);
		Sleep(ting/2);
		Beep(re1,ban);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting+ban);
		Beep(do1,ban);
		Sleep(ting);
		Beep(re1,pai);
		Sleep(ting);
		Beep(do1,ban);
		Beep(re1,ban);
		Sleep(20);
		Beep(re1,ban);
		Sleep(ting);
		Beep(so1,pai);
		Sleep(ting); 
		Beep(mi1,2*pai);
		Sleep(ting+pai);
		Beep(mi,pai);
		Sleep(ting);
		Beep(la1,2*pai);
		Sleep(ting);
		Beep(so1,2*pai);
		Sleep(ting);
		Beep(mi1,ban);
		Beep(re1,ban);
		Sleep(ting);
		Beep(do1,2*pai);
		Sleep(ting+ban);
		Beep(do1,ban);
		Sleep(ting);
		Beep(re1,pai);
		Sleep(ting);
		Beep(do1,ban);
		Beep(re1,ban);
		Sleep(20);
		Beep(re1,ban);
		Sleep(ting);
		Beep(si,pai);
		Sleep(ting);
		Beep(la,2*pai);
		Sleep(ting);
		Beep(la,ban);
		Beep(si,ban);
		Beep(do1,pai+ban);
		Beep(si,ban);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(mi1,pai);
		Sleep(ting);
		Beep(si,3*pai);
		Sleep(ting);
		Beep(mi,ban);
		Beep(mi,ban);
		Beep(la,ban+pai);
		Beep(so,ban);
		Sleep(ting);
		Beep(la,pai);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(so,2*pai);
		Sleep(ting);
		Sleep(pai);
		Beep(mi,ban);
		Sleep(ting/2);
		Beep(mi,ban);
		Sleep(ting/2);
		Beep(fa,pai+ban);
		Beep(mi,ban);
		Sleep(ting);
		Beep(fa,ban);
		Beep(do1,ban+pai);
		Sleep(ting);
		Beep(mi,2*pai);
		Sleep(ting);
		Sleep(ban);
		Beep(do1,ban);
		Sleep(ting/2);
		Beep(do1,ban);
		Sleep(ting/2);
		Beep(do1,ban);
		Sleep(ting/2);
		Beep(si,ban+pai);
		Beep(sfa,ban);
		Sleep(ting);
		Beep(sfa,pai);
		Beep(si,pai);
		Sleep(ting);
		Beep(si,2*pai);
		Sleep(ting);
		Sleep(pai);
		Beep(la,ban);
		Beep(si,ban);
		Sleep(ting);
		Beep(do1,pai+ban);
		Beep(si,ban);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);
		Beep(mi1,pai);
		Sleep(ting);
		Beep(si,2*pai);
		Sleep(ting);
		Sleep(pai);
		Beep(mi,ban);
		Sleep(20);
		Beep(mi,ban);
		Sleep(ting);
		Beep(la,pai+ban);
		Beep(so,ban);
		Sleep(ting);
		Beep(la,pai);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting); 
		Beep(so,3*pai);
		Sleep(ting+ban);
		Beep(mi,ban);
		Sleep(ting/2); 
		Beep(fa,pai);
		Sleep(ting);
		Beep(do1,ban);
		Beep(si,ban);
		Sleep(20);
		Beep(si,pai);
		Sleep(ting);
		Beep(do1,pai);
		Sleep(ting);	 
		Beep(re1,ban);
		Sleep(20);
		Beep(re1,ban);
		Sleep(20);
		Beep(mi1,ban);
		Sleep(ting/2);
		Beep(do1,pai);
		Sleep(1000);
	}
	else{
		cout<<"正在开发中..."; 
	} 
	cout<<"\a\a\a\n\n\n\n\n完毕!";
	return 0;
}

 

0
董子墨
董子墨
中级天翼
中级天翼

Beep

格式:Beep(要发出的频率(HZ),发音的时长(ms);

头文件:#include<windows.h>(万能头不包括此头文件)

我要回答