I have been learning C++ for about 2 months.
I am now learning file and ifstream.
I'm just curious if there is any game written in C++, I would like to see how did people develop those games. Of course I am not expecting new games that are released this year, maybe the games several decades ago?
Please give me some examples, a link to their source files would be better!
A large majority of games are written in C++. A small percentage of them are open-source.
Generally you can look up all your favorite games on Wikipedia and see on the right what language they were written in - tell me how many are in C++ ;)
Basically any game made by id software(id tech engine) and valve(source engine) share the same roots, as they are heavily modified versions based off of the quake engine, which was written in C and GNU assembler. If I recall correctly, Bethesda games also are related to quake.
Basically, pretty much any AAA title you can think of.
Like said above, it's quite common among AAA titles. I can't say the same for indie games though. They usually use C# or something similar, they don't need to worry about much speed, due to the smaller nature of them.
C++ itself is around 3 decades old. 1 decade if you start from when it was standardized.
How do you guys tell if the game was written in C++?
For example this game http://en.wikipedia.org/wiki/Men_of_War
It only says the engine is GEM 2, I have no idea what language the game was written in.
You can't really know what language something was written in unless the developers publish that information. In the end, it all gets compiled into machine code (Or CLI or Java Bytecode).
In your original post you thought that only multi-decade-old games were developed in C++ and then you referenced ifstream. That might be true for console-only games, but C++ is more than just the console.
iostream gives you access to write to stdout or to a log file, but C++ is much more than that. C++ gives you the ability to interface with the OS and various hardware directly. From this level of functionality, people have created libraries such as DirectX or OpenGL, CUDA, which talk directly with your video card hardware. You can use these libraries to draw graphics such as those used in any game today. People have also made libraries to wrap DirectX, OpenGL, or even Win32 to make graphical manipulation higher-level. That is, easier to manipulate by providing higher level functionality and making the details of optimization and implementation transparent to the developer.
Now a-days we have things like SFML, SDL, or Qt to make the handling of windows very easy. We can still use OpenGL when we need some low-level manipulation.
This is something that is great about C++. It's so versatile and supports high, and low, manipulation. This is why it's so popular and why so many significant titles are made with C++.