Cussin' is a bad habit, anyway. Personally, I think you're a better person for being corrected on it.
I went through the same kind of thing when I was in school, btw. Everyone else can use ugly language, but when I do it, the whole world is about to fall apart. People come out of the woodwork to shut you up when that happens.
Honestly, I think people are intrinsically alert that it's just not proper. I started using that to my advantage. Now, if it's just me and my wife, I'll say pretty much whatever I feel like saying, cuss words and all. The problem is with my own kids. We obviously would rather they not pick up on that kind of language at all. So we RARELY cuss around them. If you are a parent, you CAN'T cuss around your own kids because they'll pick up on that FAST and call you a hypocrite, and rightfully so. We've really cleaned up our mouths since our own children started talking.
And that means that we have to watch ourselves around other people, too. What's funny about that is other people who normally cuss start to notice really fast that you don't. So they'll stop cussin' around you. You'll notice that kind of thing as you get older. By setting that kind of example, what you do actually does influence other people in a positive way.
I think cussing is often misused as venting or stress relief. The problem, though, is that studies have shown that acting aggressively to "let off steam" more often and more likely AGGRAVATES the underlying emotions rather than easing them. So the more you encourage people around to "just deal" with (inward) emotions, the more you're doing them a favor--even if you take a passive role in it.
I'm 32 years old, just so you know, and I've noticed at my age a huge difference in how most adults relate to each other as opposed to the same behaviors in teenagers. We have a neighbor who can't say three words without one of them being foul language. I'm not really crazy about LOUD people, either, and she's also the kind of person who stays drunk on the weekends. The two or three times my wife has hung out with her, she's come back puking. I really don't want someone like that around my family because of how quickly the poor influence spreads. As a matter of fact, I have outright said who my wife could or couldn't be around based on how she acted around those people or what she was like after hanging out with them. I'm not a dictator in my house by any means, but I will not tolerate any kind of destructive influence. For reasons I won't go into here, there are few people we can actually trust, but those few people are people we not only trust ourselves but also trust around our children. As such, our kids don't hear a lot of bad language even around other people!
I'm not suggesting you live the kind of life that makes you feel like you're constantly being beat down. I'm just saying that maybe in THIS case with using bad words you see what's happening as a good thing. For whatever reason, someone sees you as a good person and believes you should be held to a higher standard. In public, just go with it! This is not something that will hurt you.