How to put sound in c ++?

-1

I'm still new to programming and wanted to put the sound of Super Mario inside a college project, how do I make it work?

Code:

int certo=0,errado=0,certoVF=0,certoA=0; 
char resposta,r1,r2,r3,r4,r5,r6,r7; 
int nivel,v,x; 

printf ("\t| 0 - SAIR DO GAME |\n"); 
printf ("\t| 1 - JOGAR TODOS OS NÍVEIS |\n"); 
printf ("\t| 2 - JOGAR NIVEL FÁCIL - SOMENTE O NIVEL FÁCIL |\n"); 
printf ("\t| 3 - JOGAR NIVEL MÉDIO - SOMENTE O NIVEL MÉDIO |\n"); 
printf ("\t| 4 - JOGAR NIVEL DIFÍCIL - SOMENTE O NIVEL DIFÍCIL |\n");
printf ("\t Oque deseja fazer? "); 
scanf ("%d",&nivel);
    
asked by anonymous 24.07.2018 / 21:55

1 answer

2

In the SOen there is a similar question, the answer being marked as correct, the use of the Beep function, as follows:

#include <iostream> 
#include <windows.h> // header do WinApi

using namespace std;

int main() 
{ 
    Beep(523,500); // 523 hertz (C5) por 500 milissegundos (0,5 segundos)
    cin.get(); // espera tocar o som
    return 0; 
}

Beep documentation if you want to see.

    
24.07.2018 / 22:10