A man who blows hot one minute and cold the next is a frustrating, and often emotionally draining, person to deal with. If you are dating a man, or even just really good friends with a man, who is switching from up to down with his emotions, then knowing how to handle this kind of man can help prevent you from getting hurt by his back-and-forth behaviour.
Talk it out. If one minute he's up and the next he's down, ask the obvious question of why. Discuss reasonably what you may have done or what may have happened and how it can be prevented in the future. If he becomes irate or inconsolable and doesn't want to discuss it, walk away and wait for him to cool off. If he is still unwilling to remedy the situation or wants to ignore it, think about moving on.
Tell him how his flip-flopping behaviour makes you feel in a calm and respectful manner. Whether he frustrates, saddens or puzzles you, he needs to know that his behaviour affects you, too, and hopefully will see this as a reason to change it. If he shows no regard to the fact that his behaviour is affecting you, this is a sign that he may be an emotionally abusive person and stepping out of the situation is in your best interest.
Change any behaviour that you feel might be contributing, only if it's something you feel you should change without compromising yourself. For example, if you discover that he cools toward you after you mention a past incident or boyfriend, try not to bring these things up, and if you feel you can't let them go, maybe you two shouldn't be in a relationship. Adversely, let him know as well if there are sore subjects with you that he brings up.
Don't make excuses for his behaviour. If he's had a rough day of work and is a little irritated or snaps, that can happen, but if this is a constantly occurring thing where you are permanently on eggshells around him, don't try and drum up excuses, such as a long day or past issues, to make up for it. You are only enabling the behaviour.
Seek counselling for the two of you together. If after trying to work it out on your own you're stumped, but aren't ready to give up, propose the idea of a professional third party who can serve as adviser and mediator to help work through his issues and how they affect your relationship. If he refuses to go to counselling, take this as a sign that he is not willing to go as far as you to work on the relationship, therefore you should end it now and not waste anymore of your or his time.
If your hot-and-cold guy ever gets physical toward you or uses his emotions to make you feel bad about yourself, both of these are considered forms of abuse, and you should break off the relationship immediately. Seek help from a counsellor afterward, or if you are having trouble breaking off the relationship.