I'm replying to this, even though it's been answered, because the answer has no context for what you asked for, and I wanted to correct it :/
As far as programming goes in terms of being a student... you could use any computer. I can't see anything they'd ask you to do being incredibly demanding, even if you're using JetBrains IDEs with any semi-modern CPU. I can personally say that my i7-3770 purchased 5 years ago would be overkill for a computer science student as it is.
With 4k gaming, most of that is dependent on your video card - gotta get medium-to-high-end card released in the last year to get really good fps at 4k. I know my two-year old R9 380 isn't cutting it at 4K. As far as I know, most 2017 PC games have extremely low CPU requirements, so it really doesn't matter for gaming - you need a good GPU for that, like the gtx 1080 you stated. There's very few games that would benefit from having a really fast CPU, so likely the i7 8700k is a waste of money.
Source: I've been programming and working in software development for 26 years, and I've been a software architect for 15+ of them. Unless you start building extremely large applications that take longer than 6 months and are hundreds of thousands of lines of code, you don't really need a better CPU than this i7-3770
I'm not saying to buy an i7-3770 - I'm just saying it doesn't matter much, and that i7-8700k would really just go to waste. You don't need the latest and greatest for what you asked for.
Also check this video out:
https://www.youtube.com/watch?v=KfRvpWauU6k
There is basically no difference with respect to gaming vs the 7700k, and I bet an even lower CPU would produce basically the same gaming results.