An OCR program is not trivial, it's a rather complicated subject, so no one here is going to write one from scratch to give to you. The best you'll get is someone doing a Google search and giving you links from that, so save yourself some time and just do the search yourself.
That being said,
Tesseract[
^] is an open source OCR engine that might give you a starting point.