this problem of yours is indeed due to cough
deposition in the region between the posterior parts of your nose and mouth. This in turn blocks the eustachian tube connecting the aforementioned region to your ear.Thus leading to blockage of the ear, and sometimes earache too.
The medications you've been prescribed will do the job. Don't you worry. Have faith.
Wish you a speedy recovery.