Well, I can point you to a good example of dungeon generation: Pixel Dungeon. Here is the code, you want to look at:
https://github.com/watabou/pixel-dungeon/tree/master/src/com/watabou/pixeldungeo...
*it's in java
Can't recommend anything else, try to search a bit about BSP dungeon generation. That's one of the methods, that I use.