What program do you want to use to alter the routing table?
My reaction after 1st reading your Q was: "(Trivial) If you understand
route, just put your commands in a shell script. (Preferably bash.
)
On the 2nd reading, I thought maybe you had something else in mind. In any case, there is no way we can help you without knowing what kind of a program you are writing.