Erhm, well, let's see if we can give some reasonable answers here lol?
Well, first off, check with a doctor. Secondly, when caughting up blod it is very, very, VERY seldom releated to cancer. Usually it's an indicator that you might getting infection in your lungs, or a hard cold.
Sometimes it can be as easy as it is blood which comes from your nose. You swallow some of the blood that is from your nose, then when you caught up stuff, the blood comes back up, and you confuse it from beeing releated to the stomach, other part of the body.
It can also be small scrathes in the airchannel / tube (lol what is the name for it, breathing tube? ), that makes it bleed a little.
I have with two or three situations caughter blood. All the times I did catch a cold some days later.
Hope this helps, but again, if you are scared, check with doctor, but most likely your just fine