Look for signs that your dog is getting ready to go pee in the house such as circling around, sniffing, squatting or even having it's tail stick out straight and take the dog outside right away when you notice those signs.
If the dog starts to pee or poop in the house interrupt the dog and say something like AH HA, and clap your hands and tell them they're to go outside to pee or poop and then take the dog outside and even pick the dog up and carry the dog outside if need be.
Keep the dog outside until it goes pee or poop.
If the dog isn't warning you that they need to go outside to pee then you can scold them for it and if they continue to pee or poop in the house without letting you know then you can take a rolled up newspaper and hit them on the nose with it whenever they try and pee or poop on the floor.
Or even take a spray bottle and squirt the dog with water when they start to go poop or pee in the house without letting you know.
But you need to try and get the dog to let you know they need to go outside to pee or poop before scolding the dog.