The black stuff is tar. It takes several months to get the tar out your lungs. And when you smoke, you stay sick much longer. I used to be a ciggarette smoker. I would stay sick for weeks and coughed up black stuff for about 3 or 4 months, even when I wasn't sick. My advice to you is to switch to electronic ciggarettes. The only chemical is nicotene. With the electronics, you can breath and function, and you don't smell bad. But you are fine. Everything you are going through is normal to a ciggarette smoker. Even one ciggarette a day is damaging to your lungs and your lungs do not begin healing until months after you quit.
I think the black stuff is because of the cigarettes, from tar. It takes a while to clear the poison from your system.
If you are coughing up blood, get tested for TB.
There are a lot of viruses going around, like whooping cough, flu, etc. You need to quit smoking so that when you get sick like everybody does, your cigarette use doesn't compound your problems and confuse diagnosis. It is really an idiotic thing to do, smoking.
I forgot to mention that i started smoking cigarettes about a month ago but i am down to 1 or 2 a day and thats it.