This is actually really simple. First, you might want to get a good idea of how it works. Open up the Samples C++ project that came the program and click on Dark Dungeon. Look through and you'll see how it uses variables to move the gun up and down. If you still don't understand, then I'll help you:
1. Make 2 Variables called gunWaggle and gunWaggle2 at the start of your program:
int gunWaggle; int gunWaggle2;
2. In you movement section, where you have the commands for the up key input, put this:
if (dbUpKey())
{
whatever you have already
gunWaggle+=0.55;
gunWaggle2+=0.35;
}
3. Then put this code near the bottom:
gunWaggle += 0.25f;
dbMoveObjectRight( YourGunID , 15 + sin ( gunWaggle2 / 2.0f )*0.5f);
dbMoveObject( YourGunID , 15.0f );
dbMoveObjectDown( YourGunID , 15.0f + cos ( gunWaggle / 2.0f )*0.8f);
You might want to tweak some of those values to get a more desirable result. If you have any more questions just ask!