Forget everything about cin/cout. They are useless for making graphical games (other than maybe embedding some debugging tools in your game).
A traditional simplistic game loop works like this:
1 2 3 4 5 6 7 8 9 10
|
while( game_is_running )
{
ProcessUserInputAndMessages();
UpdateAllObjects();
ClearTheScreen();
DrawTheScene();
Display();
}
|
Each time this loop happens, the game world "updates". This means you have the player's object respond to the input the user is providing... and you "update" all objects, which involves:
- moving them a tiny bit
- seeing if there are any collisions with other objects or anything else that needs to be done
- advance any animations
This loop is simple because it combines the concept of "updating" with drawing. So if you set a fixed drawing rate (like 60 FPS), then you will also have a fixed update rate (60 updates per second).. which ensures the game will run at a fixed pace no matter how fast the user's computer is.
To do things like platformer physics, the basics are simple:
1) Keep track of an object's position (typically in the form of a vector: an X,Y coordinate)
2) Keep track of the object's velocity (ie speed) -- also in the form of a vector
3) Every update, simply add their velocity to their position to move them
4) Every update, adjust their velocity according to their input, gravity, and other forces.
So if you want to employ gravity, you would simply add downward velocity every update unless the user is standing on the ground (in which case their vertical velocity would be 0. To have them jump, you just give them a burst of upward velocity... and then leave it to gravity to push them back down.
As for things like drawing... get a lib like SFML. It makes this really easy. There are tutorials which show how to get a basic program up and running, and a lot of people here will be able to answer questions about it.
http://sfml-dev.org/
I do not recommend starting with OpenGL, as it is significantly more complex and confusing. Start with SFML -- and once you get a grip on it, if you want to move to OpenGL, SFML has OpenGL bindings so the transition is relatively easy.