To create (=not play) sound files in Linux from your C++ program, you need to read the specification for each sound file, implement the usage of the specificatiion and then you're done.
However, this is difficult and needs much time.
Much simpler is the use of an audio library.
For example: libsndfile
You can find it here:
alsong with some sample programs:
Usage it simple:
install fftw (fast fourier transformation)
./configureCode:apt-get -y install fftw-dev libfftw3-dev
then the same for the tools