To avoid future cramps, work toward better overall fitness. Do regular flexibility exercises before and after you work out to stretch muscle groups most prone to cramping.
Quadriceps Muscle Stretch
You should feel this stretch in the front of your thigh.
Hold on to a wall or the back of a chair for balance. Lift one foot and bring your heel up toward your buttocks. Grasp your ankle with your hand and pull your heel closer to your body. Hold the stretch for 30 seconds.
Do: Keep your knees close together. Stop bringing your heel closer when you feel the stretch.
Do not: Arch or twist your back.
Hold each stretch briefly, then release. Never stretch to the point of pain.