Voting has taken place in Central African Republic’s presidential and legislative elections after a campaign period marked by violence between rebels and government forces.