cplusplus.com has a good guide if you want to solidify your knowledge of C++.
To use the class that jwakeman posted, you need to make use of PIDController. Basically, initialize a PIDController with P, I, and D values, a PIDSource, and a PIDOutput in your constructor.
So, say you use a victor to drive your elevator and an encoder to measure distance, you might have something like this:
Code:
Victor *ap_elevatorDrive;
PIDEncoder *ap_elevatorEncoder;
PIDController *ap_elevatorControl;
Constructor()
{
ap_elevatorDrive = new Victor(args);
ap_elevatorEncoder = new PIDEncoder(args);
ap_elevatorControl = new PIDController(1.0, 0.0, 0.0, ap_elevatorEncoder, ap_elevatorDrive);
}
Then, in your mainloop, you'd call the PIDController's SetSetpoint() method with whatever distance you want the elevator to travel to; the units are wholly dependent on the values returned by PIDEncoder's PidGet() method.
The WPILib User's Guide has a complete example of position control with a PIDController and a potentiometer.
Hope that helped,
-Alexander