To do this, you need to ask your operating system to create a window for you, and then you can set the colours of the pixels in that window.
So you need to know what operating system you are using, and then learn how to call the operating system window functions. This is difficult and often painful. If you're using windows, start here: https://msdn.microsoft.com/en-us/library/bb384843.aspx
An easier way is to use a library that talks to the operating system for you. Popular libraries are SDL and SFML, and widget toolkits ( https://en.wikipedia.org/wiki/Widget_toolkit )
If you've just started learning to program, this is going to be confusing and difficult.