More than likely because this reads as a request for code rather than an actual question. We ideally like to see some effort on behalf of the OP. What have you tried? Where are you stuck? What is the practical problem you face? The fact that you don't have the code to solve your problem does not count as a real question.
If you go to the "How to Ask" page, you will find the entry "Do your homework".
Have you thoroughly searched for an answer before asking your
question? Sharing your research helps everyone. Tell us what you found
and why it didn’t meet your needs. This demonstrates that you’ve taken
the time to try to help yourself, it saves us from reiterating obvious
answers, and most of all it helps you get a more specific and relevant
It seems the OP has put in no effort of his own. Or at the very least this is not mentioned. Questions like those tend to be closed as "not a real question" by now. Keep in mind that closure happened well after the question was initially asked. Stack Overflow has evolved significantly and what might have been perfectly fine before, might not be appropriate under current rules/guidelines.
I see now that you have updated this question to its current form after closure as "not a real question". While still not a good question after your revisions, you should really not be surprised about the closure of the original question.