You should include the cstdlib header if you are using the rand/srand/system functions. Wouldn't hurt to replace time.h with ctime as well.