Because a cough is usually the result of an underlying medical condition, it is important to treat the medical condition first in order to stop the cough.
To diagnose the cause of your cough, your doctor will look at your medical history, give you a physical exam, and sometimes carry out diagnostic tests (i.e. chest x-ray). In some cases, your doctor may also refer you to a specialist.