No. A million times no.
Hitting isn't good for any living creatures. But there's a particular drawback to using physical methods when trying to train a cat.
It's a fairly simple process in our minds:
We don't want the cat to do that...
So we do something unpleasant to the cat when they do that...
They will associate the unpleasant feeling with that thing they aren't supposed to be doing...
And they will stop.
Only that's not what happens.
As independent hunters, cats will only be interested in pleasing us when they want to please us, because we are their friends. We can scare them away from things, but not if we are the source of the scare.
That will only make them afraid of us.
When we suddenly appear, angry and mean and hurting, the cat is not going to connect their fear and pain with whatever they were doing. That has been driven right out of their minds. All they know is that we have suddenly gone crazy, and they will avoid us.
Then the cat, anxious and worried, will misbehave even more. They won't stop doing that thing. They just will not be our friends.
And I bet that not what we were after.
Read more about the best way to discipline cats.