How do i make a time limit on my console?

When i want the programme finsihed and i want the console to close, instead of the user hitting a key or inputting a character can i give it a time limit? like it executes the last part of the code and then stays open for x seconds and then closes?
Topic archived. No new replies allowed.