Functino Issues Ending Game

This is a discussion on Functino Issues Ending Game within the C++ Programming forums, part of the General Programming Boards category; Okay here is my function Code: void EndGame() { cin.get(); system("PAUSE"); } this funciton is supposed to end the game ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    5

    Exclamation Function Issues For Ending Program

    Okay here is my function

    Code:
    void EndGame()
    {
         cin.get();
         system("PAUSE");
    }
    this funciton is supposed to end the game wen it is triggered, but it doesnt. how do I work with it so that the game will end when it is triggered?
    Last edited by StoryGame464; 06-09-2009 at 06:20 PM.

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Ideally you should structure your logic so that when the game ends you'll exit all loops, return from all called functions, and leave main normally.

    Your function naturally does nothing else than reads a character of input and runs the "pause" program, resuming after it terminates (any key pressed).
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    5
    Quote Originally Posted by anon View Post
    Ideally you should structure your logic so that when the game ends you'll exit all loops, return from all called functions, and leave main normally.

    Your function naturally does nothing else than reads a character of input and runs the "pause" program, resuming after it terminates (any key pressed).
    I am as of right now very unsure of how to do that lol.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open-source Game Project
    By Glorfindel in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-24-2009, 01:12 AM
  2. So you want to be a game programmer?
    By dxfoo in forum Game Programming
    Replies: 23
    Last Post: 09-26-2006, 08:38 AM
  3. Major game issues
    By VOX in forum Game Programming
    Replies: 0
    Last Post: 01-18-2005, 07:40 AM
  4. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  5. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21