What should I do if a Professor yells at me and a fellow student in class?
I recommend following up with the professor himself. Ideally by asking for an appointment, but e-mail will do in a pinch. You should (1) concisely and clearly explain what happened (much more concisely and clearly than you did above), and (2) state that you found his reaction in class to be humiliating and unnecessary, and you would like to request that he not do anything like that again.
I also recommend being polite and avoiding accusatory language; the goal is to smooth over a misunderstanding, not to assign fault. Hopefully, this will lead to a friendly conversation, and he will take the lead in acknowledging that he misjudged the situation and his reaction was inappropriate. Sadly, I cannot guarantee this; he may entrench himself further into an adversarial position. In the latter case, it would not be inappropriate to discuss the situation with the department chair or another trusted professor; however, I do not think that doing so is terribly likely to lead to a more favorable outcome.