I got something from Tim's link. Thank you.
If I add 'getchar()' before the 'return 0' the window will stay open, showing the result, until I press enter.
But then I have to use 'enter' to quit the program, which wasn't the case when running it before in terminal.
So I would like a solution that shows the result and end the program, as in terminal.