Update main.c

Refactoring (Extract method) setWindow()