added sum, count, min, max functions. moded main

modified main to keep the window open.