Coughing too much can cause vomiting. Vomiting a yellow liquid may be due to the appearance of liquids present in the stomach at the time of vomiting, such as bile which is produced by the liver and secreted in the duodenum (the initial part of the intestine) to aid digestion. When repeated vomiting occurs, the stomach becomes empty and the bile present in the duodenum can go to the stomach and be eliminated with vomiting. In another condition, the vomit may turn yellowish in the presence of some kind of food or liquid ingested with this color or by the presence of swallowed respiratory secretion.
An uncommon situation occurs when coughing causes a pulmonary abscess (a cavity filled with pus) to rupture and the contents of the lung are eliminated by the bronchi, along with the cough, giving the impression of vomiting. This happens in more severe pulmonary infectious conditions, and is called vomica.
In cases of continuous vomiting and coughing, a medical service should be sought for evaluation and treatment of the problem.