What you ask for is a lot more complex than vilml has done. The first thing I would learn to do is read them in a strings and start parsing. There are many documents out there on the web on how to do what you ask for. Not to mention you could find odd bits to what you want to find in most compilers. atoi is limiting and I would learn to use stringstream if wanted to convert from strings to actual numbers because it has a lot of great tools for restricting things and/or catching errors in input.