It is possible your dog may have caught an upper respiratory illness such as kennel cough or possibly canine influenza. A heart condition such as heartworms can also cause a cough, which will need to be checked if your dog is not on heartworm preventative or an older dog.
Kennel cough is normally contracted when a dog has been boarded or kenneled or around a large number of dogs such as at a dog show, dog park or pet store. The cough associated with kennel cough is frequently described as a hairball type cough. There are also many different causes of "kennel cough" so one case may be different than another case. Here is a website with more information on kennel cough. http://www.thepetcenter.com/gen/kenc.html
Canine influenza is now becoming more prevalent and like it sounds it is a canine flu. Here is an excellent site on it.
You will want to monitor your dogs condition looking for colored discharge from the nose or eyes, a productive cough (coughs stuff up), stops eating or lethargy. These are signs of a possible bacterial infection as well and my require antibiotics. If your dog appears to be having a difficult time breathing, you will need to see your Vet as some dogs dog get really sick with canine influenza and need support to recover.
To help your dog breathe easier you can run a NON-medicated humidifier in the room your dog is in, or sit in a steamed up bathroom with your dog to help keep the mucous moving. Robitussin DM at a 1/4 teaspoon per 5 pounds can be used to control the cough. Dosages can be obtained at this website. http://www.petplace.com/drug-library/dextromethorphan-robitussin-dm/page1.aspx
If your dog has not had all its vaccinations I urge you to have your dog seen as soon as possible.
The following site goes over canine coughs.
Since your dog is becoming elderly, and it has been going on for so long, I would have him seen so antibiotics can be prescribed and his heart checked over. I hope you find this information helpful.