Cucumbers, squashes and melons are all in the cucurbita family of plants. Most of them make long vines, but some do not. They look very similar as seedlings, but as they begin to flower and make fruit, it is easier to tell them apart in the garden. Looking at the flower size, the shape of the tiny fruit behind the female flowers, and the general habit of the plant will give you an idea of what vegetable you are looking at.
Observe the growth habit of the plant in question. Cucumber and melon plants are usually smaller at first than squash plants. The leaves are smaller, and the stems are not as thick. Summer and winter squash plants grow very fast in the early days of summer, whereas melon and cucumber plants take a while to get big.
Look at the shape of the leaf. A watermelon plant has a characteristic appearance: it is more deeply lobed than a cantaloupe, squash or cucumber leaf. If you are looking at a watermelon plant, it is likely that the vines have started running along the ground almost immediately.
Determine if the plant is trying to climb upwards using tendrils, or if it is running along the ground. A cucumber plant will attempt to grow vertically, putting out strong tendrils that will grab onto anything and pull the plant upwards. Some melons will climb, although more weakly. Summer squash never puts out tendrils, although some winter squash do. Summer squash will stay bushy rather than sending out vines and tendrils along the ground.
Check the stem to see if it is somewhat spiny. The stems of squash plants are often somewhat prickly, whereas cucumbers and melons never are. Their stems are somewhat fragile looking compared to squash stems. Next, observe the flower, once the plant begins flowering. Cucumber and melon flowers will be small, about the size of a nickel, whereas squash flowers are large, several inches across. The flowers open in the morning, and there are male and female flowers. The female flowers will be the ones that form the fruit.
Check below the flower and see if a small fruit is forming there. Once the female flower has been pollinated by insects, the flower will close and wilt, and a small fruit will form at the base of the flower. Look at the size and shape of this fruit to see what kind of cucurbita it is. Cucumbers will usually form long thin fruits, a watermelon or cantaloupe will be round, and some winter squash have a characteristic bulge at one end of the fruit.