Note how we move all the messy window creation to a separate function (which would normally be in a separate header file, but out here for display purposes). This code will create a window, paint the background black and will have the title of "A window for <Dream in Code>"

edited to add picture and a typo

( Why would you wish edit to add a typo? )

Thank you for a nice exercise, easy to follow, I'm posting one small suggested alteration to show that I understood the code: