Here is the completed program. You'll need to run it in a dos window.