Added implementation of both popular ways of doing it. You'll be prompted at the beginning of program.