There is another way to make a sound, quite simple, you load a wave file and play it:

// play a wave file sound using the winmm library
// For DevCpp add the library libwinmm.a to linker via 
// Project/Project Options/Parameters/Add Library
// remember this is a console program!

#include <iostream>
#include <windows.h>   // for PlaySound()

#define SND_FILENAME 0x20000
#define SND_LOOP 8
#define SND_ASYNC 1

using namespace std;

int main()
  // play sound as loop (remove SND_LOOP for one time play)
  // file boing.wav has be in the working directory
  cin.get(); // wait
  return 0;

Will this work even in C while i use a turbo or borland C compiler. If it does where do i get the winmm library?

7 Years
Discussion Span
Last Post by Ancient Dragon

It will not work with Turbo C because that compiler can not call any of the ms-windows library functions. As for borland, it depends on which version you are using. If its a 16-bit version like Turbo C, then that compiler will not work either.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.