I have to bandwagon copeg here. Even tho Abhilash has a point in that each programmer has his/her own way of implementing things and one can often notice a certain style for each programmer, there definitely is conventions and so called "best practices" for programming in general and for each language in specific. And even on concept/task level ( for example best practices for socket programming in Java ). One can google for these and the result list is huge. Just remember to mirror the credentials of the writer to the claims - many of these articles have (probably) been written by people that don't really have the authority to give out best practices -advises ( e.g. Bjarne Stroustrup giving out tips on how to do stuff in C++ versus some newly graduated software engineer doing the same. You'd had to take the latter with a grain of salt. ).
I have enjoyed the Steve McConnell's Code Complete SE book
Code Complete, Second Edition | Microsoft having a good amount of good practices for programming in general. As well as the Clean Code -book
http://www.amazon.com/Clean-Code-Han.../dp/0132350882 by Robert C. Martin. But everyone has their own favourites, right?
Anyhow, your program seems fine to me for the scope of it, no worries
. Shortness of program isn't always a virtue either, at least if the size doesn't add to performance too much.