Well, "what it should be" and what actual companies do here in the US
are two separate things. It can also differ by state, since corporate
law is based in state law rather than federal law.
A stock-based corporation typically has a board of directors overseeing
the well-being of the corporation, and executives overseeing the
day-to-day operations. The President is normally the highest ranking
executive for a given business unit (an entity for which things like
financials are not shared with other units). Most corporations consist
of a single business unit, but a few consist of a group of separate
business units, each with its own President. In the latter case,
one person must be chosen as the CEO (usually the President of the
most important/general business unit). Why? Because corporate law
precedent requires a recognizable chain of authority from the Board
to a single person (CEO), and continuing on down the chain. If the
corporation includes only one business unit, and thus one President,
the CEO title is implied (though sometimes added to spruce up an offer).
Precedent just means that if the corporation has a different type of
management structure, they are more vulnerable to litigation regarding
appropriate business practices, particularly from disgruntled shareholders.
Managing director would also apply, but only if the CEO is a member
of the Board of Directors (not required).
The other CxO titles are intended to make it clear that a given person
has ultimate responsibility for the day-to-day operations related to x.
In other words, they aren't supposed to go crying to their boss -- they
must make the decision. Most new companies are unclear on that distinction
and just use CFO, CIO, CTO, etc. willy-nilly.