programming a limit switch

how do you program a limit switch on c++?

Should probably search Chief Delphi for answers.

However, you would use a DigitalInput object ( and use the Get() function to check whether the switch is high or low.

The correspondence of TRUE to HIGH or FALSE to HIGH is dependent on your wiring.