repeating a function

This is a discussion on repeating a function within the C++ Programming forums, part of the General Programming Boards category; ok, so I have my function (int main () ) run, then it works, but how do I get it ...

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    43

    repeating a function

    ok, so I have my function (int main () ) run, then it works, but how do I get it so it repeats?

    i've just put a while (bool = true) loop, around the contents of it (while the condition being true, until your lives are all gone)

    now, how do I get it to remember players_points (the integer)

    each time, it keeps resetting to 1! (i know, why, just not how to fix it)
    Last edited by Mythic Fr0st; 01-17-2007 at 09:36 PM.

  2. #2
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    917
    step 1: read the loops tutorial.
    step 2: post your code.
    *edit* you can declare (and initialize) the variable before the loop. You probably are initializing it at the beginning of the code block within the loop.*edit*
    Last edited by CodeMonkey; 01-17-2007 at 09:46 PM.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    43

    ty

    Thanks, worked great!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 04:06 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 02:01 AM
  4. Replies: 28
    Last Post: 07-17-2006, 12:35 AM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 07:44 PM

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