Watermelon: Many people swear by the "thumping" technique, where you thwack it to hear how it sounds. A hollow sound is good. But it'll sound different depending on where you hit it, so it's better for entertainment than as a practical technique. It should be heavy for its size (it'll be more juicy). But best is to check the lighter-colored patch where it rested on the ground. You want it to be distinct and yellowish in color.

Cantaloupe: By far the best way is to smell the stem end. It should smell like... well, cantaloupe. Often, it won't smell like much of anything, which means it's pretty much tasteless. Or that your nose is clogged. Watch out, though, if it smells too strong -- it may be rotten.