This appears to be C+ homework. We want to help you get the information you need, but we also are concerned that just giving you the answer will rob you of the necessary skills you'll need to develop. If you can describe the things you've tried and how they haven't worked for you, perhaps someone can give you a nudge in the right direction.
Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!
Suggest you investigate "Handwriting Recognition". You don't indicate your target platform; open-source or commercial software, so it is difficult to suggest libraries. For example, Microsoft has Microsoft.Ink and some sort of Azure service.
Please follow-up to let us know how you made out. For good karma, mark a reply as the answer if it helped!