Wondering about repeating an entire program

This is a discussion on Wondering about repeating an entire program within the C++ Programming forums, part of the General Programming Boards category; okay, so i have a basic calculator program (sorry i can't post it, on another computer) but i have the ...

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    8

    Wondering about repeating an entire program

    okay, so i have a basic calculator program (sorry i can't post it, on another computer) but i have the entire calculator as a function. So to run it i just need to type : calculator(); after that i have these little lines as a function, and i type lines(); and it looks like this:
    -----------------------------------------------------------------------------------

    anyways, how do i make it so that my program will repeat the calculator function every time, after the lines function? is it some kind of loop?? i couldn't figure out if it was!

    thanks in advance!

    Chris

  2. #2
    Registered User
    Join Date
    Oct 2003
    Posts
    8
    nm guys, i figured it out myself! i read some earlier posts and this is what i got:

    Code:
     do{ 
     calculator();
     lines();
     } while (1==1)
    thanks!
    Last edited by Chrisab508; 10-16-2003 at 07:47 PM.

  3. #3
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Location
    Mt. Prospect, IL
    Posts
    2,572
    someone actually using the "search" button??...no, can't be. LOL, good for you Chrisab!

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  4. #4
    ...
    ... is offline
    Registered User
    Join Date
    Feb 2002
    Posts
    465
    a better idea might be to return a variable (maybe a bool) from the calculator function, and if the person chooses to exit the program the calculator function returns false. otherwise it returns true.

    for example

    Code:
    // prototype
    bool calculator();
    
    int main()
    {
    
       while ( calculator() );
    
    return 0;
    }

    that while loop is basically an empty loop that accomplishes the same thing as yours did, but it gives the option to exit the program.
    I came up with a cool phrase to put down here, but i forgot it...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 10:17 PM
  3. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  4. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

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