The fact that your cough began along with other symptoms of a cold, bronchitis or other upper respiratory infection makes it likely that you have developed ticklish and hyper-reactive airways in your lungs. You may also notice wheezing. Doctors often refer to this persistent cough (with or without wheezing) as "temporary asthma" or "asthmatic bronchitis."
Usually a cough that persists following an upper respiratory illness starts as a viral infection. The long-lasting cough does not mean your infection is still active. After the infection has cleared, your airways can remain irritated during the healing process. The cough (and wheeze) should resolve within a couple months. Sometimes it will last even longer.
Less often, the initial problem was a bacterial infection, such as pertussis (whooping cough) or mycoplasma. In the later stages of one of these bacterial infections, antibiotics are not usually very helpful.
If your cough has already lasted 3 weeks or more, contact your doctor.
If your cough is a lingering symptom from an upper respiratory infection, your doctor may suggest trying an inhaler. Most often doctors prescribe an albuterol inhaler as a short-term treatment to relax your airways and reduce the cough.
Although this is a likely explanation for your cough, let's explore some other possibilities.