Kudos to you for asking questions and trying to learn the correct way to train your puppy.
Basically, in order to correct a dog (and by "correct", I mean a verbal reprimand, not physical punishment) you need to catch the dog in the act. There is only a 2-3 second window between cause and effect that the dog will understand what it's being corrected for. Anything longer than a few seconds, and your dog will have no idea what you are correcting it for. Punishing after that fact will only make the dog afraid of you and will weaken the trusting relationship he has with you.
Remember, he's just a baby - if he eliminates in the house, it's not his fault - it's the owner's for not watching the pup close enough or taking him out soon enough. A puppy should NEVER be out of your sight. If you can't supervised him, he should be somewhere safe, like in his crate. The puppy should never be allowed to go into another room where he can eliminate without your knowing. Putting up gates can help you keep the pup in the same room with you so you can keep a closer watch on him.
How old is your pup? When we were housebreaking Red, we took him out every 30 minutes without fail, and after eating, drinking, sleeping, chewing, and playing. Or anytime he was circling or sniffing the ground like he was looking for somewhere to go. We never gave him the opportunity to eliminate in the house. Each time the dog pee/poops in the house, you derail your housetraining. This is why it's so important to be consistent about the training. Trust me, it's worth the time and the effort to do the right thing now rather than to have dog that takes forever to housebreak because the training is not consistent.
Good luck, and keep asking questions
