or get rid of system("pause"); and use cin.get();