The King and Queen are addressed as "Your Majesty" upon first greeting, at which point you bow or curtsy depending on gender. In the UK, it's customary to perform a head bow - where you bend slightly from the waist and lower your head. Curtsies simply place your left leg behind your right like a ballet dancer, bend your knees outward and lower your head. If you're wearing a dress, hold it up so the skirts don't get caught. After that, address them as Sir or Ma'am (Ma'am is in palm, not Mam as in ham)
Princes and Princesses have the style "Your Royal Highness" and then Sir or Ma'am from then on.
With both Queens and Princesses, wait for them to extend their hand to you, as you would with any other woman in any other situation. And don't touch them either, its against royal protocol.