Why is there no the before president and captain?
They elected him president.
She was made captain of the team.
The ‘Longman Student Grammar of Spoken and Written English’ (LSGSWE) explains it thus:
When a predicative noun phrase names a unique role or job, either a zero article or the is used.
The is not normally found after words like elected (and re-elected) which show that someone has been appointed to an office. The LSGSWE’s own example is ‘Lukman was re-elected OPEC President in June.’ In other cases, however, it’s optional. The LSGSWE’s second example is: ‘Simon Burns is the chairman of the appeal board.’ That could equally well appear as ‘Simon Burns is chairman . . .’