Preventing vomiting and diarrhea involves good hygiene practices such as regular handwashing, especially after using the bathroom and before eating. Ensuring that food is properly cooked and stored can also help. For infants, breastfeeding can offer some protection against infections.