First off, don't run. Sounds like common sense but many people, scared from an up-close encounter with a predator, do this very thing. Running will trigger the chase-mechanism of a cougar (also called puma and mountain lion). This is similar to dragging a string in front of a kitten--it has no recourse but to chase it.
Years ago when I worked for the Forest Service, I had the good fortune of spending time with some of the finest cougar trackers and biologists in the country. They pretty much all told me the same thing- when confronted with a cougar, make yourself look intimidating (open your jacket for instance to increase your size), yell, throw rocks and sticks, and make yourself out to be unappealing while backing up slowly (without turning your back). This is another good reason to carry a whistle, aside from signaling to rescuers when lost. Predators the world over, both four-legged and two-legged, like an easy victim and they don't want to get hurt.
Research indicates that 80 percent of attacks occur with children, so keep them close when hiking and instruct them on how to behave in cougar country in case they do encounter one on a future campout or dayhike. Nowadays it seems that most cougar-human problems happen in areas where cities and the wilderness intersect. I recall one of my survival students who sent me a photo of a cougar that had crept into his garage during the day in Prescott, Arizona. In New Mexico, a cougar broke into a jewelry store in downtown Santa Fe.
One thing is for sure, we should be grateful that we are not more appetizing to mountain lions. As legendary cougar biologist Harley Shaw once told me, "If you've spent time hiking in the wilderness, then you have already been within striking distance of a cougar!"